ITeye博客

Struts1.2分模块后的路径问题

liss · 2011-05-22 18:00 · Java编程 · 企业架构 · Spring · Struts · XML · JSP · Web · Markdown

1.某项目分模块的web.xml配置如下: config /WEB-INF/struts-config.xml config/rights /WEB-INF/rights-struts-config.xml 2.rights-struts-config.xml中某action的配置如下: 3.请求路径如下: http://localhost:8080/netctoss_my/rights/listrights.do?type=1 出现错误如下: 2009-07-08 11:53:31,906 ERROR [org.apache.struts.action.RequestProcessor] - Invalid path was requested /listrights 当action的path改为 path="/listrights",则出现如下错误: HTTP Status 404 - /rights/rights/rightbrowse.jsp type Status report message /rights/rights/rightbrowse.jsp description The requested resource (/rights/rights/rightbrowse.jsp) is not available. 再把Forward中path属性前面的/rights 去掉,则页面跳转正确。 4.页面表单Form的请求: 相对路径:action="listrights.do" 没有right开头,直接现对http://localhost:8080/netctoss_my/rights/index.jsp中的right模块 绝对路径:action="action="<%=request.getContextPath()%>/rights/listrights.do""

查询条件:   模块名称: 权限名称:

总结:Struts1.2在分模块的配置文件中,根据web.xml的配置: config/rights /WEB-INF/rights-struts-config.xml 前面默认加上了rights。所以在rights-struts-config.xml的配置中,action的path属性不用加上/rights了。 但是,如果整合了Spring,需要对action注入业务service,则spring的资源文件配置如下: name="/rights/listrights,不管Spring是否分了模块,这都要加上/rights模块名

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。