[img]http://img.my.csdn.net/uploads/201205/30/1338368707_9167.png[/img]
web.xml
<?xml version="1.0" encoding="UTF-8"?>
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_3_0.xsd">
struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
struts2
/*
index.jsp
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
index.jsp
login.jsp
login.jsp
LoginAction.java
package test;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = -5102850352318204106L;
public String username;
public String password;
public String execute(){
if(!username.equals("admin")){
super.addFieldError("username:", "用户名错误");
return ERROR;
}
if(!username.equals("001")){
super.addFieldError("password:", "密码错误");
return ERROR;
}
return SUCCESS;
}
public void validate(){
if(username == null||username.length() == 0){
super.addActionError("用户名不能为空!");
}
}
}
访问方式:http://localhost:8080/test/login.jsp
问题:404错误,路径有什么问题?求指点