本人正在学习J2EE,前几天编写了一个登录界面,但是一运行就报404,各个文件的路径都是正确的
第一步进入登录页面没有问题,输入用户名和密码后提交,进入ActionLogin_1.java进行处理,但是到这里就报404了:
HTTP Status 404 - /J2EE_firstexercise/ActionLogin_1--------------------------------------------------------------------------------type Status reportmessage /J2EE_firstexercise/ActionLogin_1description The requested resource (/J2EE_firstexercise/ActionLogin_1) is not available.
--------------------------------------------------------------------------------Apache Tomcat/6.0.10另外我的struts.xml内部的文件路径也是写对了的:<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" 
"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
 <package name="default" extends="struts-default">
  <action name="actionlogin_1" class="textlogin.ActionLogin_1">
   <result name="success">/success.jsp</result>
   <result name="error">/error.jsp</result>
  </action>
 </package>
</struts> 但是就是无法跳转页面!
顺便说下ActionLogin_1.java的源代码,我编写了个Dao类来进行对数据库的操作,代码都是没有问题的:
package textlogin;import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;public class ActionLogin_1 extends ActionSupport implements ModelDriven<User>
{
private User user=new User(); public User getModel() {
return user;
} @Override
public String execute() throws Exception 
{
Dao userdao=new Dao();
    boolean flag = userdao.validateLogin(user.getUsername(), user.getPassword());
        if(flag)
        {
return SUCCESS;
     }
else
{
return ERROR;
}
}
}