There is no Action mapped for namespace [/] and action name [] associated with c struts2eclipse 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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="itcast" namespace="/test" extends="struts-default"> <action name="helloworld" class="cn.itcast.action.HelloWorldAction"> <!-- 定义逻辑视图和物理资源之间的映射 --> <result name="error">index.jsp</result> <result name="success">/WEB-INF/page/hello.jsp</result> </action> </package></struts> namespace="/test" 将设置为 namespace="/" 试试看 Action找不到 你确定地址没写错吗应该是 项目名/test/helloword HelloWorldAction.java的内容package cn.itcast.action;import com.opensymphony.xwork2.ActionSupport;public class HelloWorldAction extends ActionSupport { private String msg; public String getMessage() { return msg; } public String execute(){ msg ="我的第一个struts应用"; return "success"; }} web.xml的配置:<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"><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>hello.jsp</welcome-file> </welcome-file-list></web-app> 看看是否缓存的影响,把tomcat缓存清理下,把浏览器缓存清理下,然后重新发布项目,重启tomcat。还有问题的话,楼主把你的页面贴出来吧。 清了crhrome的缓存,还是一样的 这个是hello.jsp:<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><meta http-equiv="Expires" content="0"><meta http-equiv="kiben" content="no-cache"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title></head><body> ${message }</body></html> 楼主贴错了,要的是index.jsp ,请求的配置在index.jsp里面 把index.jsp贴出来 楼主,你访问地址出错了,因为你在配置文件中配置的是/test,所以访问的时候地址应该是:http://localhost:8080/Struts2/test/这个才是正确的访问地址你原先访问的是:http://localhost:8080/Struts2/,服务器会默认找/下面的应用,找不到肯定给你报错呀 项目启动后手动输入http://localhost:8080/Struts2/test/hello http://localhost:8080/Struts2/test/helloworld 这个访问路径http://localhost:8080/Struts2/test/helloworld 没有错的,代码处看也没什么错,楼主,把配置的Tomcat服务器删除了,重新建一个,清空浏览器缓存再试试 java中有没有透明贴图??就像C中那种图片中指定颜色透明?? 背景如何拉伸 java程序获取tomcat的虚拟目录的问题? jbpm3.1+spring2.0.6+hibernate+oracle9i java数据库连接池? 新手使用JBUILDER以STRUTS开发,遇到个小问题! webwork连接spring 某些文件只能放在tomcat\bin 下面? 下载开源东东的时候有两个链接,一个是二进制文件,另一个是源文件,请问二者区别 用tomcat能部署EJB吗 struts常见的配置问题,我就是弄不出来 javaee遇到一个错误,不晓得怎么改,求大神们指导
<?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="itcast" namespace="/test" extends="struts-default">
<action name="helloworld" class="cn.itcast.action.HelloWorldAction">
<!-- 定义逻辑视图和物理资源之间的映射 -->
<result name="error">index.jsp</result>
<result name="success">/WEB-INF/page/hello.jsp</result>
</action>
</package>
</struts>
应该是 项目名/test/helloword
package cn.itcast.action;import com.opensymphony.xwork2.ActionSupport;public class HelloWorldAction extends ActionSupport {
private String msg;
public String getMessage() {
return msg;
} public String execute(){
msg ="我的第一个struts应用";
return "success";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<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>hello.jsp</welcome-file>
</welcome-file-list>
</web-app>
还有问题的话,楼主把你的页面贴出来吧。
清了crhrome的缓存,还是一样的
这个是hello.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<meta http-equiv="Expires" content="0">
<meta http-equiv="kiben" content="no-cache">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
${message }
</body>
</html>
http://localhost:8080/Struts2/test/
这个才是正确的访问地址
你原先访问的是:
http://localhost:8080/Struts2/,服务器会默认找/下面的应用,找不到肯定给你报错呀