How to get the action name in freemarker in Struts2?
e.g http://localhost/market/pcsuite/edit.action
Can I get the action name "edit" in the freemarke开发者_C百科r file edit.flt?
<@s.property value="com.opensymphony.xwork2.ActionContext.name" />
Or
<@s.set var="actionName" value="com.opensymphony.xwork2.ActionContext.name" />
<#-- Use as -->
<@s.property value="actionName" />
<#-- Or other FreeMarker Tags -->
Or
Create a getter in action class
, e.g.
public String getActionName() {
return ActionContext.getContext().getName();
}
<@s.property value="actionName" />
精彩评论