struts2的问题HTTP Status 404 - There is no Action mapped for action name register.

问题描述

我的jsp<%@pagelanguage="java"import="java.util.*"pageEncoding="utf-8"%><%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"><html><head><linkhref="css/bootstrap.min.css"rel="stylesheet"type="text/css"/><scripttype="text/javaScript"src="js/jquery-1.9.1.min.js"></script><scripttype="text/javaScript"src="js/bootstrap.min.js"></script><title>考试管理系统</title><metahttp-equiv="pragma"content="no-cache"><metahttp-equiv="cache-control"content="no-cache"><metahttp-equiv="expires"content="0"><metahttp-equiv="keywords"content="keyword1,keyword2,keyword3"><metahttp-equiv="description"content="Thisismypage"><!--<linkrel="stylesheet"type="text/css"href="styles.css">--></head><divclass="container-fluid"><divclass="row-fluid"><divclass="span12"><h3class="text-center">在线考试管理系统</h3><ulclass="navnav-tabs"><liclass="active"><ahref="#">首页</a></li><li><ahref="#">登录</a></li><li><ahref="#">退出</a></li><li><ahref="register/register">注册</a></li><liclass="dropdownpull-right"><aclass="dropdown-toggle"data-toggle="dropdown"href="#">快捷操作</a><ulclass="dropdown-menu"><li><ahref="#">密码找回</a></li></ul></li></ul></div></div></div><body><br></body></html>我的struts.XML<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstrutsPUBLIC"-//ApacheSoftwareFoundation//DTDStrutsConfiguration2.0//EN""http://struts.apache.org/dtds/struts-2.0.dtd"><struts><packagename="default"extends="struts-default"namespace="register"><actionname="register"class="com.zyb.action.Register"><resultname="ok">register.jsp</result></action></package></struts>我的action类packagecom.zyb.action;importcom.opensymphony.xwork2.ActionSupport;publicclassRegisterextendsActionSupport{/****/privatestaticfinallongserialVersionUID=1L;publicStringexecute(){return"ok";}}---------------------------------------action找不到?求解释。谢谢

解决方案

解决方案二:
你的jsp放在哪个目录下面的?
解决方案三:
放在webroot下面了
解决方案四:
看下你的配置吧,一般找不到ACTION,都是配置未配好导致的。。
解决方案五:
你的web.xml怎么配,过滤器那里,会不会配了后缀.do,访问url却没加.do<filter-mapping><filter-name>struts2</filter-name><url-pattern>/*.do</url-pattern></filter-mapping>
解决方案六:
引用2楼u010175788的回复:

放在webroot下面了

那就对了,你在配置文件中指定了namespace=register<packagename="default"extends="struts-default"namespace="register">那么struts找的时候,会先找register/register.action,然后再到默认命名空间下找register.action也是没有的而此时你的文件在webroot下,对应的是默认默认命名空间所以此时解决方法,要么去掉namespace="register",要么把这个jsp放在webroot/register目录下
解决方案七:
我的是因为jar包的版本不对,,我用A版本写了个action然后importA的东西。。。发现不行找不到。然后换用B版本,结果还是找不到。其实我把那个Struts.xml首字母大写了。然后改成小写。在启动tomcat发现,自动弹出debug。我又把Action类从新写了一下,就OK了。。。namespace不写相当于有个/
解决方案八:
struts这个配置文件是个错误但是不管换几个版本,只要你不改变一开始你配置的namespace,然后你那个jsp还是放在webroot下面,肯定还是找不到
解决方案九:
哥们你的<base><%=basePath%></base>好像没写啊那就得要用绝对地址啊
解决方案十:

解决方案十一:
namespace改为/register,应该可以了
解决方案十二:
大神你好。我在学习java,你的这个在线考试系统能不能给我借鉴1340517737@qq.com
解决方案十三:
首先观察你页面上注册的链接写对吗?namespace好像应该是/register
解决方案十四:
/register貌似正解

时间: 2024-08-12 09:20:16

struts2的问题HTTP Status 404 - There is no Action mapped for action name register.的相关文章

HTTP Status 404 - There is no Action mapped for action name login. 帮我看一下,哪里有问题。

问题描述 struts.xml的代码,struts.xml也是在src目录下的:<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstrutsPUBLIC"-//ApacheSoftwareFoundation//DTDStrutsConfiguration2.1.7//EN""http://struts.apache.org/dtds/struts-2.1.7.dtd"

ssh整合-Struts框架初学者问题,HTTP Status 404

问题描述 Struts框架初学者问题,HTTP Status 404 刚刚接触ssh框架,自己正在慢慢学习中,昨天写了一个很简单的登录界面,结果一直有问题,进不去.报错:The requested resource (/EasyModel/) is not available. 下面是配置文件: Web.xml <?xml version="1.0" encoding="UTF-8"?> xmlns:xsi="http://www.w3.org

servlet-找不到Servlet错误 HTTP Status 404 - /emp_system/UserServlet

问题描述 找不到Servlet错误 HTTP Status 404 - /emp_system/UserServlet myeclipse 打开Tomcat服务器运行login.jsp文件后显示404找不到UserServlet,但是web.xml配置没错,求解答! 解决方案 关于http status 404的问题JSP错误,HTTP Status 404关于HTTP Status 404 - /SmallTest/inex.jsp错误 解决方案二: 求解答求解答!!!! 解决方案三: 配置文

HTTP Status 404 -(tomcat,springmvc,ModelAndView)

HTTP Status 404 -(tomcat,springmvc),访问404找不到路径解决: 问题1:把tomcat添加到eclipse下,直接访问"http://localhost:8080/",404错误: 问题2:搭建完springmvc的web工程后,访问进入欢迎页404错误: 问题3:在springmvc的扫描类中,可以正常映射"String"返回值的视图,ModelAndView返回值下可以进入方法,但不能正常返回视图,访问进入欢迎页404错误.

java-最简单的struts2程序,总是提示404,求大神指点

问题描述 最简单的struts2程序,总是提示404,求大神指点 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd&qu

出现HTTP Status 404的错误

问题描述 在myeclipse中,右击我建的web项目,在Java Compiler中Compiler compliance level设置为5.0,启动tomcat,可以正常运行:但是改为6.0后,启动tomcat,就出现HTTP Status 404的错误,为什么?还有 我新下的tomcat需要设置一些东西么...? 问题补充:walnutprince 写道 解决方案 http://hi.baidu.com/litertiger/blog/item/737ab809dee8e2256b60f

struts2中文件上传拦截器 是不是不能在多个action中引用???

问题描述 <global-results> <result name="input">/message.jsp</result></global-results><!--定义全局的返回视图--><action name="updateHead" class="updateHead"> <interceptor-ref name="fileUpload"

struts2之There is no Action mapped for namespace / and action name

问题描述 以前也配过很多次struts2,觉得没什么问题,可是昨天改了改tomcat的设置,现在再怎么弄都配不好了,连个helloworld都不成功了.觉得很奇怪.贴出来给哪位大牛帮我看看吧分不多,先谢谢啊.我真是郁闷到了.错误信息是:ThereisnoActionmappedforactionnamelogin.-[unknownlocation]com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java

xmlHttp.status=404.求教帮忙检查URL或Xml的配置

问题描述 <%@pagecontentType="text/html"pageEncoding="UTF-8"%><!DOCTYPEhtml><html><head><metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"><scripttype="text/javascript&q