下午在eclipse中配置struts2时报:

There is no Action mapped for namespace [/] and action name [Login] associated with context path [/eprint]

错误

做如下检查:

1、确保struts.xml文件名大小写正确:struts.xml

2、确保struts.xml文件在src目录下(很重要!后面就着重说这个)

附:

web.xml文件内容

示例:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app version="3.0"
  3. xmlns="http://java.sun.com/xml/ns/javaee"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  6. http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
  7. <display-name></display-name>
  8. <filter>
  9. <filter-name>struts2</filter-name>
  10. <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  11. </filter>
  12. <filter-mapping>
  13. <filter-name>struts2</filter-name>
  14. <url-pattern>/*</url-pattern>
  15. </filter-mapping>
  16. <welcome-file-list>
  17. <welcome-file>index.jsp</welcome-file>
  18. </welcome-file-list>
  19. </web-app>

struts.xml:

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE struts PUBLIC
  3. "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
  4. "http://struts.apache.org/dtds/struts-2.3.dtd">
  5. <struts>
  6. <package name="default" namespace="/" extends="struts-default">
  7. <action name="LoginAction" class="com.xxx.control.LoginAction">
  8. <!-- 定义逻辑视图和物理资源之间的映射 -->
  9. <result name="error">index.jsp</result>
  10. <result name="success">/WEB-INF/main.jsp</result>
  11. </action>
  12. </package>
  13. </struts>

index.jsp:

  1. <s:form action="LoginAction" namespace="/">
  2. <s:textfield name="username" label="username"></s:textfield>
  3. <s:password name="password" label="password"></s:password>
  4. <div id="login_button">
  5. <input type="submit" value="login"/>
  6. </div>
  7. <div  id="register_button">
  8. <input type="button" value="register"/>
  9. </div>
  10. </s:form>

反复确认之后,还是没找到错误

找度娘,好多种解决方案,木有一个可以解决我的问题的

最后发现是我的struts.xml是在src目录下,没有任何疑问

但是我的编译后classes文件默认却是在build目录下

不在WEB-INF下.......

这样它是找不到struts.xml文件的,报如上错误,也是情有可原的

最后,明确一点,struts.xm位于src下是为了编译后能找到struts配置文件,确保其在WEB-INF下才是根本!!!

更改eclipse web 项目默认编译输出路径:

eclipse中只能针对项目更改,因为其默认的是build目录下的,只能以项目更改: 
项目右键 -》properties -》JavaBuild Path -》source -》Default output folder,选择你的路径,ok!

eclipse中配置struts2出现There is no Action mapped for namespace [/] and action name [Login] associated wi的更多相关文章

  1. (原创)超详细一步一步在eclipse中配置Struts2环境,无基础也能看懂

    (原创)超详细一步一步在eclipse中配置Struts2环境,无基础也能看懂 1. 在官网https://struts.apache.org下载Struts2,建议下载2.3系列版本.从图中可以看出 ...

  2. 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 ...

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

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

  4. 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 ...

  5. struts2方法无法映射问题:There is no Action mapped for namespace [/] and action name [m_hi] associated with context path []

    使用struts的都知道,下面使用通配符定义的方式很常见,并且使用也很方便: <action name="Crud_*" class="example.Crud&q ...

  6. struts2报错:There is no Action mapped for namespace [/] and action name [userAction!add]

    使用struts2.3进行动态方法调用时出现: There is no Action mapped for namespace [/user] and action name [user!add] a ...

  7. struts2中错误提示:There is no Action mapped for namespace / and action name

    当在struts2中运行时出现如上所述错误时: 1.在src目录下创建struts.xml一定要注意拼写 2.struts.xml文件中引入和extend是否正确 3.在web.xml 中<we ...

  8. Struts2.5以上版本There is no Action mapped for namespace [/] and action name [userAction_login] associated with context path []

    分析:Struts2在2.5版本后添加strict-method-invocation(严格方法访问),默认为true,不能使用动态方法调用功能,故需设为false struts.xml设置如下: & ...

  9. 【转】在Eclipse中配置tomcat

    转载地址: http://kin111.blog.51cto.com/738881/163096 为了在Eclipse中进行struts2的测试,才发现自己机器上的Eclipse没有集成Tomcat, ...

随机推荐

  1. github--403错误

    错误信息如下: $ git push origin master error: The requested URL returned error: while accessing https://gi ...

  2. RGW 系统吞吐量(TPS)、用户并发量、性能测试概念和公式

      一.系统吞度量要素: 一个系统的吞度量(承压能力)与request对CPU的消耗.外部接口.IO等等紧密关联. 单个reqeust 对CPU消耗越高,外部系统接口.IO影响速度越慢,系统吞吐能力越 ...

  3. PHP完整的AES加解密算法使用及例子(256位)

    依赖PHP自身的mcrypt扩展 <?php class aes { // CRYPTO_CIPHER_BLOCK_SIZE 32 private $_secret_key = 'default ...

  4. android Webview Html5 相关文章

    Android WebView的使用集锦(支持Html5) http://blog.csdn.net/l_215851356/article/details/69239643 WebView详解与简单 ...

  5. [BZOJ3672][Noi2014]购票 斜率优化+点分治+cdq分治

    3672: [Noi2014]购票 Time Limit: 30 Sec  Memory Limit: 512 MBSubmit: 1749  Solved: 885[Submit][Status][ ...

  6. DotNetOpenAuth实践之WebApi资源服务器

    系列目录: DotNetOpenAuth实践系列(源码在这里) 上篇我们讲到WCF服务作为资源服务器接口提供数据服务,那么这篇我们介绍WebApi作为资源服务器,下面开始: 一.环境搭建 1.新建We ...

  7. [实战]MVC5+EF6+MySql企业网盘实战(8)——文件下载、删除

    写在前面 上篇文章通过iframe实现了文件的无刷新上传.这篇我们将实现文件的下载与删除. 系列文章 [EF]vs15+ef6+mysql code first方式 [实战]MVC5+EF6+MySq ...

  8. WPS Office 2012 专业版 附正版序列号

    WPS Office 2012 专业版 附正版序列号 首先说说WPS的研发历史沿革:1988年5月,一个名叫求伯君的程序员凭借一台386电脑写出了WPS 1.0,从此开创了中文字处理时代,并迅速占领中 ...

  9. spring_150901_hibernate_transaction_xml

    实体类: package com.spring.model; import javax.persistence.Entity; import javax.persistence.Id; import ...

  10. bzoj 1856 卡特兰数

    复习了一下卡特兰数.. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #d ...