Struts 2 <s:if> tag How to get action name to be evaluated in jsp

二次信任 提交于 2019-11-30 23:55:16

You can get action name from the context

<s:if test="#context['struts.actionMapping'].name=='addaction'">
   do some stuff
</s:if>

Since Struts version 2.3.34 and 2.5.13 #context is not available anymore because of security reasons (see WW-4852) As a workaround you can use #request which is documented here

<s:if test="#request['struts.actionMapping'].name=='addaction'">
   do some stuff
</s:if>

Try this

<s:if test='%{com.opensymphony.xwork2.ActionContext.name=="YourActionName"}'>
     //do some stuff
</s:if>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!