访问action的注意事项

来源:互联网 发布:java文件夹加密解密 编辑:程序博客网 时间:2024/05/06 05:45

 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类中的一个方法

原创粉丝点击