美文网首页
Struts2 2.5以上版本,动态方法调用

Struts2 2.5以上版本,动态方法调用

作者: 清蘂翅膀的技术 | 来源:发表于2019-04-04 16:35 被阅读0次

1、struts.xml 中

<!-- 允许动态方法调用:开发中不建议使用容易暴露动作类中的动态方法 -->      

<constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>

<package name="p1" extends="struts-default" strict-method-invocation="false" namespace="/">          

    <global-allowed-methods>regex:.*</global-allowed-methods>      

 <!-- 动态方法调用, struts.enable.DynamicMethodInvocation 要设置成true;注意此时,packgae 中 namespace 必须设置,不能默认为空 -->           

    <action name="user" class="com.itheima.web.action.UserAction">

    <result name="success">/success.jsp</result> </action> </package>                                                                                                                 

2、jsp加跳转

<a href="${pageContext.request.contextPath }/user!addUser.action">新增用户</a>

相关文章

网友评论

      本文标题:Struts2 2.5以上版本,动态方法调用

      本文链接:https://www.haomeiwen.com/subject/cprqiqtx.html