开发者

How to get the action name in freemarker in Struts2?

开发者 https://www.devze.com 2023-03-22 07:37 出处:网络
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\" /&g

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" />
0

精彩评论

暂无评论...
验证码 换一张
取 消