请教下关于struts2配置的问题 实在找不到是哪里错了
我刚开始学习struts2 今天做了个简单的login.jsp的测试页面,老是出现404错误找不到响应的页面,我估计是配置问题 但是花了几个小时,也参照网上的资料,还是成功不了,实在是没办法了,求各位指教一下:
login.jsp
......
<body>
<form action="login.action" method="post">
uesrname:<input type="text" name="username"><br>
password:<input type="password" name="password"><br>
<input type="submit" name="submit" value="提交">
</form>
</body>
......
result.jsp
......
<body>
username:${requestScope.username}
password:${requestScope.password}
</body>
......
相应的LoginAction // struts2 后的action 不用像struts1继承相应的类吗?
package com.test.action;
public class LoginAction {
......
}
配置struts.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>
<package name="struts2" extends="struts-default">
<action name="login" class="com.test.action.LoginAction">
<result name="success">/result.jsp</result>
</action>
</package>
</struts>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<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>
我通过 http://127.0.0.1:8080/struts2/login.jsp 可以访问login.jsp 页面,点提交按钮后,出现404错误:The requested resource (/struts2/login.action) is not available. 请各位给我指教下我的配置有问题吗 ?另外请请有经验的高手给我点相关建议 谢谢谢谢
环境:jdk 1.6 tomcat 5.5 myeclipse 6.0