Struts2之jsp页面取得当前actionName

在页面上加入<s:debug />, 我们就可以查看stackContext的信息

其中有一项:Key为com.opensymphony.xwork2.ActionContext.name里面保存的就是actionName

直接使用<s:property value="com.opensymphony.xwork2.ActionContext.name" />就可以得到

常用例:

<s:set var="actionName" id="actionName" value="com.opensymphony.xwork2.ActionContext.name"></s:set>

<s:if test="#actionName=='recommendReg'">

doSomeThings

</s:if>

<s:else>

doOtherThings

</s:else>

 页面显示${actionName }

以下为<s:debug />信息

原文地址:https://www.cnblogs.com/hhwww/p/11138384.html