下午在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. 在Ubuntu上安装搜狗输入法

    1.进入搜狗输入法官网 2.下载Linux版本,选择64bit 下载 3.等待下载的同时,进行系统配置 进入系统设置->语言支持->进行更新(需要输入登录密码)->在键盘输入法系统选 ...

  2. Nginx源码分析--数组(转)

    原文地址:http://blog.csdn.net/marcky/article/details/5747431 备注:以下关于Nginx源码的分析基于淘宝开源项目Tengine. Nginx中对数组 ...

  3. Java显式锁学习总结之三:AbstractQueuedSynchronizer的实现原理

    概述 上一篇我们讲了AQS的使用,这一篇讲AQS的内部实现原理. 我们前面介绍了,AQS使用一个int变量state表示同步状态,使用一个隐式的FIFO同步队列(隐式队列就是并没有声明这样一个队列,只 ...

  4. 用户代码未处理EntityCommandExecutionmException报错解决方案

    原因可能是(1)没有编译好,清理解决方案,重新生成解决方案.          (2)可能是WebSiteConfiguration.DbProviderName;中为DbProviderName属性 ...

  5. linux 大法

    实验楼 练习 小笔记 可以输出图形字符的命令banner 你可以先使用如下命令安装: $ sudo apt-get update $ sudo apt-get install sysvbanner 然 ...

  6. awk练习总结

    >>> >>>awk是个优秀文本处理工具,可以说是一门程序设计语言.下面是awk内置变量. 一.内置变量表 属性 说明 $0 当前记录(作为单个变量) $1~$n ...

  7. HTTP协议的重新学习

    思论:做互联网一年多了,想了想对http协议的认识还处于很笼统的阶段,抽休息时间,重新梳理一下自己的网络知识. 1.什么叫HTTP协议? HTTP协议是Hyper TEXT Transfer Prot ...

  8. java.io.BufferedWriter API 以及源码解读

    下面是java se 7 API 对于java.io.BufferedWriter 继承关系的描述. BufferedWriter可以将文本写入字符流.它会将字符缓存,目的是提高写入字符的效率. bu ...

  9. Linux命令之gdisk

    gdisk -l [设备] gdisk又叫GPT fdisk,算是fdisk的延伸吧,主要使用的是GPT分区类型,用来划分容量大于2T的硬盘. 扩展1:分区类型GPT和MBR.GPT最大支持18EB( ...

  10. Scrapy实战篇(六)之Scrapy配合Selenium爬取京东信息(上)

    在之前的一篇实战之中,我们已经爬取过京东商城的文胸数据,但是前面的那一篇其实是有一个缺陷的,不知道你看出来没有,下面就来详细的说明和解决这个缺陷. 我们在京东搜索页面输入关键字进行搜索的时候,页面的返 ...