写了一个JSP项目,在配置struts2时遇到了这个错误,在网上逛了一大圈后终于解决了这个问题。具体解决方法是:

1、struts.xml的名字和位置

这里特别提一点,很多人遇到这个错误都是名字错误,比如写成struts-login.xml但又没在web.xml中进行相关配置。struts.xml是struts2的默认配置名字所以不用再web.xml中配置。 第二点是位置问题,很多人说是放在src根目录下,其实不然,在部署后的web项目中是没有这个目录的试问struts2又怎么访问这个配置文件?正确的是放在WEB-INF/classes目录下,有些用myeclipse的朋友可能会说:“怎么我放在src目录下还是能运行呢?”这是因为IDE在部署项目时将struts.xml自动拷贝到了WEB-INF/classes下。我就是自己用ant完成这个拷贝步骤的。

2、Form表单

在表单中设置属性时如果使用的不是默认命名空间一定要声明。

3、struts.xml内容

一定要确认action的name属性填写无误,其实在一般的小型项目中使用默认命名空间就够了,不用设置namespace属性。此外一定要确认classes目录下有相应action的class类文件。

There is no Action mapped for namespace [/] and action name [login] associate解决办法 .的更多相关文章

  1. struts2中错误There is no Action mapped for namespace [/] and action name [] associated with context path

    1 There is no Action mapped for namespace [/] and action name [] associated with context path [/Stru ...

  2. Struts2中关于"There is no Action mapped for namespace / and action name"的总结

    今天在调试一个基础的Struts2框架小程序.总是提示"There is no Action mapped for namespace / and action name"的错误. ...

  3. 报错:HTTP Status 404 - There is no Action mapped for namespace [/] and action name [product-save] associated with context path [/20161101-struts2-2].

    运行:index.jsp---->input.jsp----->details.jsp,但是在input.jsp到details.jsp的时候报错误. 异常如下: 严重: Could no ...

  4. Struts2-tomcat报错:There is no Action mapped for namespace / and action

    HTTP Status 404 - There is no Action mapped for namespace / and action name first. type Status repor ...

  5. There is no Action mapped for namespace [/pages/action/student] and action name [findStudent]

    1.错误描写叙述 2014-7-13 2:38:54 org.apache.jasper.compiler.TldLocationsCache tldScanJar 信息: At least one ...

  6. There is no Action mapped for namespace / and action name UserAction

    果断收藏了,说的非常具体.刚開始学习的人常常遇到的问题. There is no Action mapped for namespace / and action name UserAction 在网 ...

  7. eclipse中配置struts2出现There is no Action mapped for namespace [/] and action name [Login] associated wi

    下午在eclipse中配置struts2时报: There is no Action mapped for namespace [/] and action name [Login] associat ...

  8. eclipse使用SSH框架出现There is no Action mapped for namespace [/] and action name [] associated with context path错误

    eclipse使用SSH框架出现There is no Action mapped for namespace [/] and action name [] associated with conte ...

  9. struts 2.5 There is no Action mapped for namespace [/] and action name [user_find] associated with context path [/struts2_crm].

    遇到了这个错误. There is no Action mapped for namespace [/] and action name [user_find] associated with con ...

  10. Could not find action or result: There is no Action mapped for namespace [/] and action name [GetG

    Could not find action or result: /car/GetGpsDataAction  There is no Action mapped for namespace [/] ...

随机推荐

  1. 2018-10-19-Roslyn-使用-Directory.Build.props-文件定义编译

    title author date CreateTime categories Roslyn 使用 Directory.Build.props 文件定义编译 lindexi 2018-10-19 18 ...

  2. Java练习 SDUT - 2669_2-2 Time类的定义

    2-2 Time类的定义 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 通过本题目的练习可以掌握类与对象的定义: 设计 ...

  3. C++复制初始化的限制

    相比于直接初始化,复制初始化有更加严格的限制. 1:在复制初始化时,不能使用声明为explicit的构造函数进行的隐式转换.而直接初始化则是允许的: struct Exp { explicit Exp ...

  4. hibernate 出现Caused by: java.sql.SQLException: Column 'id' not found.异常

    用hibernate进行映射查询时,出现Caused by: java.sql.SQLException: Column 'id' not found 异常,检查数据库表及映射都有id且已经正确映射, ...

  5. 为什么不喜欢在 QQ 群里回答问题?

    为什么不喜欢在 QQ 群里回答问题? 没有主题,主题随时都在变. 回答后无法备份,当然自己有心可以总结一下. 实时性要求太强,可能回答但是突然有事离开,再回头看已经是 几十条的留言. QQ 群用来闲聊 ...

  6. 读取Excel文件的两种方法比较 以及用NPOI写入Excel

    1. 采用NPOI方式,只需引用NPOI.dll,但目前最高只能到2.4.0版. 缺点:只支持.xls,不支持.xlsx格式.github上的2.4.1版支持.xlsx,但总提示缺ICSharpCod ...

  7. 利用阿里云容器服务打通TensorFlow持续训练链路

    本系列将利用Docker和阿里云容器服务,帮助您上手TensorFlow的机器学习方案 第一篇:打造TensorFlow的实验环境 第二篇:轻松搭建TensorFlow Serving集群 第三篇:打 ...

  8. Android Studio(十):添加assets目录

    Android Studio相关博客: Android Studio(一):介绍.安装.配置 Android Studio(二):快捷键设置.插件安装 Android Studio(三):设置Andr ...

  9. H3C 会话层、表示层和应用层

  10. git pull 和git fetch区别?

    git:从远程分支获取最新的版本至本地有两个命令. git fetch 相当于从远程获取最新的版本至本地,但不会自动merge git pull 相当于从远程获取最新的版本并merge至本地