Struts调用方法是要用:动态方法调用DMI
struts.xml核心部分:
调用方法:http://localhost:8080/工程名/user/user!add(ps:add是类UserAction中的一个方法)
注意:新版的Struts2的DMI功能默认是关闭的,需要在struts.xml中打开:
struts.xml核心部分:
<span style="font-size:14px;"><struts>
<constant name="struts.devMode" value="true"/>
<package name="user" extends="struts-default" namespace="/user">
<action name="user" class="hpu.edu.cn.UserAction">(注:hpu.edu.cn.UserAction是包名+包内的类名)
<result>/hello.jsp</result>
</action>
</package>
</struts></span>
调用方法:http://localhost:8080/工程名/user/user!add(ps:add是类UserAction中的一个方法)
注意:新版的Struts2的DMI功能默认是关闭的,需要在struts.xml中打开:
<span style="font-size:14px;"><constant name="struts.enable.DynamicMethodInvocation" value="true"/>
</span>