zoukankan      html  css  js  c++  java
  • Struts2之页面取得当前actionName

    在页面上加入<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
  • 相关阅读:
    《代码整洁之道》三
    《代码整洁之道》二
    第五周总结
    第四周总结
    第三周总结
    第二周总结
    第一周总结
    课程总结
    周总结16
    河北省科技信息通用调查系统综合查询功能开发——Day9
  • 原文地址:https://www.cnblogs.com/firstdream/p/2377653.html
Copyright © 2011-2022 走看看