日期:2014-05-20  浏览次数:20680 次

菜鸟struts2入门求助
登录login.jsp
<%@ page language="java" contentType="text/html; charset=GBK"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   
   
  <title>登录页面</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">  
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

  </head>
  
  <body>
  <form action="Login.action" method="post">
  <table align="center">
  <caption>user login</caption>
  <tr>
  <td>Username:<input type="text" name="Username"/></td>
  </tr>
  <tr>
  <td>Password:<input type="text" name="Password"/></td>
  </tr>
  <tr align="center">
  <td colspan="2"><input type="submit" value="login"/>
  <input type="reset" value="reset2"/></td>
  </tr>
  </table>
  </form>
  </body>
</html>

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>

  <constant name="struts.enable.DynamicMethodInvocation" value="false" />
  <constant name="struts.devMode" value="false" />
   
  <package name="1" extends="struts-default">
  <action name="Login.action" class="rtcrud.LoginAction">
  <result name="success">welcome.jsp</result>
  <result name="error">error.jsp</result>
  </action>
  </package>

  <!-- Add packages here -->

</struts>

Loginaction.java

package rtcrud;

public class LoginAction {
private String Username;
private String Password;
private final String Success="success";
private final String Error="error";
public String getUsername() {
return Username;
}
public void setUsername(String username) {
this.Username = username;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
this.Password = password;
}
public String execute() throws Exception{
if(getUsername().equals("scott")&& getPassword().equals("tiger")){
return Success;
}
else{
return Error;
}
}
}



页面报错 The requested resource (/new/Login.action) is not available.


求帮助!!!先行谢过!!


------解决方案--------------------
LoginAction这个类放在哪了
------解决方案--------------------