【发布时间】:2012-06-22 11:30:15
【问题描述】:
只是想知道是否有人见过或写过客户标签来调用 Struts2 Actions。
我正在寻找的是这样的:-
<s:button value="Click Me!" action="thisIsMyAction" >
<s:param name="productId" value="%{productId}" />
<s:param name="userId" value="%{userId}" />
</s:button>
这样你就有了 Action
public String thisIsMyAction() {
String productId = getServletRequest.getParameter("productId");
String userId= getServletRequest.getParameter("userId");
// Do some stuff here.
return SUCCESS;
}
原因是,我们不想使用 href 或图像,而且我们并不总是提交表单。
提前干杯
【问题讨论】:
-
您希望这个按钮具体做什么?和链接一样吗?如果是这样,为什么不简单地使用 CSS 将链接样式设置为按钮?
-
这和使用 href 差不多,所以我不确定这样做的目的
标签: struts2 tags struts tld struts-action