struts.xml不在默认位置,导致出现HTTP Status 404 - There is no Action mapped for namespace [/] and action name [
2016-04-07 17:21
861 查看
使用maven构建的web项目没有将struts.xml放在resources根目录下,而是放在struts2/struts.xml中
结果运行出错
HTTP Status 404 - There is no Action mapped for namespace [/] and action name [userAction_login] associated with context path [/MyWeb].
解决方法:手动指定配置文件的位置
在web.xml文件下修改struts2的filter
添加init-param
问题解决
注意仍然需要重新找struts-default.xml和struts-plugin.xml文件位置
当配置文件分开写比如上面的struts-user.xml文件,include时候写成相对路径也不能找到配置,需要在主配置文件struts.xml中使用
结果运行出错
HTTP Status 404 - There is no Action mapped for namespace [/] and action name [userAction_login] associated with context path [/MyWeb].
解决方法:手动指定配置文件的位置
在web.xml文件下修改struts2的filter
添加init-param
<init-param> <param-name>config</param-name> <param-value>struts-default.xml,struts-plugin.xml,struts2/struts.xml</param-value> </init-param>
问题解决
注意仍然需要重新找struts-default.xml和struts-plugin.xml文件位置
当配置文件分开写比如上面的struts-user.xml文件,include时候写成相对路径也不能找到配置,需要在主配置文件struts.xml中使用
<include file="struts2/struts-user.xml"></include> 加上文件夹
相关文章推荐
- maven学习
- maven插件maven-war-plugin的使用
- jenkins------部署项目到jboss eap下
- maven使用经验集
- struts2 jquery 打造无限层次的树
- 使用struts2+Ajax+jquery验证用户名是否已被注册
- struts2入门Demo示例
- 通过Ajax两种方式讲解Struts2接收数组表单的方法
- Struts2+Hibernate实现数据分页的方法
- ajax交互Struts2的action(客户端/服务器端)
- struts2 spring整合fieldError问题
- Struts2的s:radio标签使用及用jquery添加change事件
- 使用MyEclipse 开发struts2框架实现登录功能(结构教程)
- struts2 中文乱码的解决办法分享
- Struts2访问servlet分享
- struts2单个文件上传的两种实现方式
- struts2+jsp实现文件上传的方法
- struts2+jquery实现ajax登陆实例详解
- struts2中一个表单中提交多个请求的例子(多个提交按钮)
- JQuery+Ajax+Struts2+Hibernate框架整合实现完整的登录注册