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

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

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

常用例:

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

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

doSomeThings

</s:if>

<s:else>

doOtherThings

</s:else>

 

以下为<s:debug />,片段

com.opensymphony.xwork2.dispatcher.HttpServletRequest org.apache.struts2.dispatcher.StrutsRequestWrapper@1ae7f61
com.opensymphony.xwork2.ActionContext.locale en_US
com.opensymphony.xwork2.dispatcher.HttpServletResponse com.opensymphony.module.sitemesh.filter.PageResponseWrapper@12cc880
com.opensymphony.xwork2.ActionContext.name recommendReg

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-29
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案