1.确定是否已经在struts.xml中进行action的配置
2.确定在该action中是否有该方法的存在
3.确定包名空间是否正确namespace="/cya"
如下配置文件:
<struts>
<package name="cya" namespace="/cya" extends="struts-default">
<interceptors>
<!-- 定义权限控制拦截器 -->
<interceptor name="authority"
class="com.topsoft.cya.web.interceptor.AuthorizationInterceptor" />
</interceptors>
<!-- 定义全局处理结果 -->
<global-results>
<result name="login">/admin/index.jsp</result>
</global-results>
<!-- 信息操作 -->
<action name="*_Info" method="{1}"
class="com.topsoft.cya.web.action.info.InfoAction">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="authority" />
<result name="ZuiXinGG">/admin/info/ZuiXinGG.jsp</result>
</action>
</package>
</struts>
4.要访问InfoAction中的某一方法时的访问路径应该如下:
cya/save_Info.action
注:save 是InfoAction类中的一个方法
本文详细介绍了Struts2框架中的配置过程,包括如何在struts.xml文件中进行action配置、确保方法存在及正确的命名空间设置等。此外还提供了具体配置示例及访问路径的规范。
167万+

被折叠的 条评论
为什么被折叠?



