Action Tag
The action tag is a generic tag that is used to call actions directly from a JSP page by specifying the action name and an optional namespace. The body content of the tag is used to render the results from the Action. Any result processor defined for this action in struts.xml will be ignored, unless the executeResult parameter is specified.
Add the following code snippet into the struts.xml file.
struts.xml
| <action name="actionTag" class="net.roseindia.actionTag"> <result name="success">/pages/genericTags/success.jsp</result> </action> |
Create an action class as shown below:
actionTag.java
package net.roseindia; |
Now create a jsp page using <s:action> tag as shown in the success.jsp page. The action tag is used to call actions directly from a JSP page by specifying the action name and an optional namespace.
success.jsp
<%@ taglib prefix="s" uri="/struts-tags" %> |
Output of the success.jsp


本文介绍如何使用 Struts2 中的 ActionTag 直接从 JSP 页面调用 Action,并展示了具体的实现步骤与代码示例。
1万+

被折叠的 条评论
为什么被折叠?



