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>
<include file="struts-default.xml"/>
<package name="sunyang" extends="struts-default" namespace="/user">
<action name="login1">
<result name="success">/success.jsp</result>
<result name="error">/error.jsp</result>
</action>
</package>
<constant name="struts.locale" value="en_GB"/> </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/j2ee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<display-name>Struts 2.0 Hello World</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>登录页面主要代码<body>
<center>
<form action="login1" method=post>
用户名:<input type=text name=username><br>
密码:<input type=password name=password><br>
<input type=submit value="提交">
</form>
</center>
</body>
一点提交就报404错误:HTTP Status 404 - /struts1/WebRoot/login1--------------------------------------------------------------------------------type Status reportmessage /struts1/WebRoot/login1description The requested resource (/struts1/WebRoot/login1) is not available.
--------------------------------------------------------------------------------Apache Tomcat/6.0.10这是什么原因啊,希望各位高手给指点指点!!!!!!!!!!
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd"> <struts>
<include file="struts-default.xml"/>
<package name="sunyang" extends="struts-default" namespace="/user">
<action name="login1">
<result name="success">/success.jsp</result>
<result name="error">/error.jsp</result>
</action>
</package>
<constant name="struts.locale" value="en_GB"/> </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/j2ee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<display-name>Struts 2.0 Hello World</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>登录页面主要代码<body>
<center>
<form action="login1" method=post>
用户名:<input type=text name=username><br>
密码:<input type=password name=password><br>
<input type=submit value="提交">
</form>
</center>
</body>
一点提交就报404错误:HTTP Status 404 - /struts1/WebRoot/login1--------------------------------------------------------------------------------type Status reportmessage /struts1/WebRoot/login1description The requested resource (/struts1/WebRoot/login1) is not available.
--------------------------------------------------------------------------------Apache Tomcat/6.0.10这是什么原因啊,希望各位高手给指点指点!!!!!!!!!!
另外还有你的struts.xml 配置的action 也不对啊<action name="login1" class="****" >
<result name="success">/success.jsp </result>
<result name="error">/error.jsp </result>
</action>
2.包声明了 命名空间namespace 在请求的时候 要加上 /user/login1.action
另外你的 struts.xml 配置的action 也不对, 还有class 属性你没有写 <action name="login1" class="*********">
<result name="success">/success.jsp </result>
<result name="error">/error.jsp </result>
</action>