4
回答
HTTP Status 404 - There is no Action mapped for namespace [/] and action name [chkLogin] associated with context path [/shzoj].
【寻找人气王】邀新用户免费体验华为云服务,百元话费等你拿!   

我的struts2.xml

<?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">
<struts>
	<constant name="struts.ui.theme" value="simple" />
	<constant name="struts.i18n.encoding" value="UTF-8" />

	
	<package name="default" extends="struts-default">
<action name="chkLogin" class="action.UserAction"
			method="login">
			<result name="input">/login.jsp</result>
			<result name="success" type="redirect">/index.jsp</result>
			<result name="error">/login.jsp</result>
</action>
</package>
</struts>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">

	<!--FilterDispatcher类在struts2-core.jar包中 -->
	<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>

	<!-- 数据源引用部分 -->
	 <resource-ref>
         <description>JNDI JDBC DataSource</description>
         <res-ref-name>jdbc/ins</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-auth>Container</res-auth>
     </resource-ref>
	<!--添加欢迎页面 -->
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>

</web-app>

login.jsp

<s:form cssClass="form"  method="post" action="chkLogin" >
                    <p><span>User :</span><s:textfield name="user.uUser" cssClass="text" /></p>
                  <p><span>Pass :</span><s:password name="user.uPass" cssClass="text" /></p>
                  <p><span></span><input type="submit" name="button" id="button" value="Login" class="btn" />
                  <a href="#">Find PWD</a> | <a href="reg.jsp">Register</a></p>
              </s:form>

出现的错误

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [chkLogin] associated with context path [/shzoj].

type Status report

message There is no Action mapped for namespace [/] and action name [chkLogin] associated with context path [/shzoj].

description The requested resource (There is no Action mapped for namespace [/] and action name [chkLogin] associated with context path [/shzoj].) is not available.
Apache Tomcat/7.0.26

求大神帮忙啊!!谢谢。

<无标签>
举报
Jerikc
发帖于6年前 4回/11K+阅
共有4个答案 最后回答: 5年前

引用来自“javacc”的答案

怎么解决的啊??
< s:form cssClass = "form"  method = "post" action = "chkLogin" >
2                     <p><span>User :</span><s:textfield name="user.uUser" cssClass="text" /></p>
3                   <p><span>Pass :</span><s:password name="user.uPass" cssClass="text" /></p>
4                   <p><span></span><input type="submit" name="button" id="button" value="Login" class="btn" />
5                   <a href="#">Find PWD</a> | <a href="reg.jsp">Register</a></p>
6               </s:form>

 

上述代码中,我的user.uPass写错了。改正即可。

引用来自“Jerikc”的答案

引用来自“javacc”的答案

怎么解决的啊??
< s:form cssClass = "form"  method = "post" action = "chkLogin" >
2                     <p><span>User :</span><s:textfield name="user.uUser" cssClass="text" /></p>
3                   <p><span>Pass :</span><s:password name="user.uPass" cssClass="text" /></p>
4                   <p><span></span><input type="submit" name="button" id="button" value="Login" class="btn" />
5                   <a href="#">Find PWD</a> | <a href="reg.jsp">Register</a></p>
6               </s:form>

 

上述代码中,我的user.uPass写错了。改正即可。

您这解决方法,跟您的报错:没有对应的action也不符合啊?
顶部