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] associated with context path [/eprint]
错误
做如下检查:
1、确保struts.xml文件名大小写正确:struts.xml
2、确保struts.xml文件在src目录下(很重要!后面就着重说这个)
附:
web.xml文件内容
示例:
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app version="3.0"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
- <display-name></display-name>
- <filter>
- <filter-name>struts2</filter-name>
- <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>struts2</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list>
- </web-app>
struts.xml:
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
- "http://struts.apache.org/dtds/struts-2.3.dtd">
- <struts>
- <package name="default" namespace="/" extends="struts-default">
- <action name="LoginAction" class="com.xxx.control.LoginAction">
- <!-- 定义逻辑视图和物理资源之间的映射 -->
- <result name="error">index.jsp</result>
- <result name="success">/WEB-INF/main.jsp</result>
- </action>
- </package>
- </struts>
index.jsp:
- <s:form action="LoginAction" namespace="/">
- <s:textfield name="username" label="username"></s:textfield>
- <s:password name="password" label="password"></s:password>
- <div id="login_button">
- <input type="submit" value="login"/>
- </div>
- <div id="register_button">
- <input type="button" value="register"/>
- </div>
- </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的更多相关文章
- (原创)超详细一步一步在eclipse中配置Struts2环境,无基础也能看懂
(原创)超详细一步一步在eclipse中配置Struts2环境,无基础也能看懂 1. 在官网https://struts.apache.org下载Struts2,建议下载2.3系列版本.从图中可以看出 ...
- 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 ...
- Struts2中关于"There is no Action mapped for namespace / and action name"的总结
今天在调试一个基础的Struts2框架小程序.总是提示"There is no Action mapped for namespace / and action name"的错误. ...
- 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 ...
- 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 ...
- 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 ...
- struts2中错误提示:There is no Action mapped for namespace / and action name
当在struts2中运行时出现如上所述错误时: 1.在src目录下创建struts.xml一定要注意拼写 2.struts.xml文件中引入和extend是否正确 3.在web.xml 中<we ...
- 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设置如下: & ...
- 【转】在Eclipse中配置tomcat
转载地址: http://kin111.blog.51cto.com/738881/163096 为了在Eclipse中进行struts2的测试,才发现自己机器上的Eclipse没有集成Tomcat, ...
随机推荐
- scrapy shell 用法(慢慢更新...)
scrapy shell 命令 1.scrapy shell url #url指你所需要爬的网址 2.有些网址数据的爬取需要user-agent,scrapy shell中可以直接添加头文件, 第①种 ...
- python开发web服务器——搭建简易网站
参看:https://blog.csdn.net/baidu_35085676/article/details/69807145
- leetcode 之Median of Two Sorted Arrays(五)
找两个排好序的数组的中间值,实际上可以扩展为寻找第k大的数组值. 参考下面的思路,非常的清晰: 代码: double findMedianofTwoSortArrays(int A[], int B[ ...
- Java的Stack类实现List接口真的是个笑话吗
今天在网上闲逛时看到了这样一个言论,说“Java的Stack类实现List接口的设计是个笑话”. 当然作者这篇文章的重点不是这个,原本我也只是一笑置之,然而看评论里居然还有人附和,说“Ja ...
- scala学习5--函数二
to def test() : Unit = { // for(i <- 1.to(100)){ // println(i) // } for(i <- 1 to 100 ){ prin ...
- Java门派的风险
Java门派的风险 正在看周思博(www.joelonsoftware.com)的新文章.这次是疯狂攻击Java.主要论点是:Java不够难,作为工业语言不错,但作为学校的教学语言,就忒差了.学校应该 ...
- CSU 1425 Prime Summation
原题链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1425 DP题. f[i][j]表示当前数字为i,分解式中最大质数为j的方案数,那么,状态 ...
- MVC – 5.MVC设计模式和.NetMVC框架
MVC模式-设计模式 •控制器(Controller)- 负责转发请求,对请求进行处理. •视图 (View) - 界面设计人员进行图形界面设计. •模型 (Model)-业务逻辑.数据.验证规则.数 ...
- JS函数学习
=============数学函数========== 1.Math.random()为取随机数0~1之间的:0可以取到,1取不到 alert(Math.random()); 2.Math.PI为3. ...
- Solr本地服务器搭建及查询
0.安装solr之前,确保已安装好java8, java -version 查看是否安装 1.新建本地目录solr1 并 解压两个压缩包文件 .tar.gz .tgz tomcat7 2.将CATA ...