HTTP Status 404 - /16/WebRoot/admin_index.jsp
type Status report
message /16/WebRoot/admin_index.jsp
description The requested resource is not available.
Apache Tomcat/7.0.63
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">
/admin_{1}.jsp
/admin_{1}.jsp
/car_{1}.jsp
/car_{1}.jsp
car_queryCarList.action
/customer_{1}.jsp
customer_queryCustomerList.action
customer_queryCustomerList.action
/goods_{1}.jsp
goods_queryGoodsList.action
web.xml的配置文件:
<?xml version="1.0" encoding="UTF-8"?>
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/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
struts2
org.apache.struts2.dispatcher.FilterDispatcher
struts2
/*
index.jsp
一部分AdminAction的代碼:
public class AdminAction extends AdminForm {
private static AdminDao adminDao = null;
static{
adminDao=new AdminDao();
}
// 對登錄用戶的表單驗證是否為空
public void validateIndex() {
if (null == admin_user || admin_user.equals("")) {
this.addFieldError("admin_user", "| 請您輸入用戶名");
}
if (null == admin_password || admin_password.equals("")) {
this.addFieldError("admin_password", "| 請您輸入密碼");
}
}
// 對登錄用戶的表單驗證
public String index() {
String query_password = adminDao.getAdminPassword(admin_user);
if (query_password.equals("")) {
this.addActionError("| 該用戶名不存在");
return INPUT;
}
if (!query_password.equals(admin_password)) {
this.addActionError("| 您輸入的密碼有誤,請重新輸入");
return INPUT;
}
session.put("admin_user", admin_user);
return SUCCESS;
}
// 對修改管理員密碼表單驗證是否為空
public void validateUpdatePassword() {
if (null == admin_password || admin_password.equals("")) {
this.addFieldError("admin_password", "請輸入原密碼");
}
if (null == admin_repassword1 || admin_repassword1.equals("")) {
this.addFieldError("admin_repassword1", "請輸入新密碼");
}
if (null == admin_repassword2 || admin_repassword2.equals("")) {
this.addFieldError("admin_repassword2", "請輸入密碼確認");
}
if (!admin_repassword1.equals(admin_repassword2)) {
this.addActionError("您輸入兩次密碼不相同,請重新輸入!!!");
}
}
public String updatePassword() {
String query_password = adminDao.getAdminPassword(admin_user);
if (!admin_password.equals(query_password)) {
this.addFieldError("admin_password", "您輸入的原密碼有誤,請重新輸入");
}
String sql = "update tb_admin set admin_password='" + admin_repassword1
+ "' where admin_user='" + admin_user + "'";
if (!adminDao.operationAdmin(sql)) {
this.addActionError("修改密碼失敗!!!");
return INPUT;
} else {
request.setAttribute("editPassword", "您修改密碼成功,請您重新登錄!!!");
return SUCCESS;
}
}
}
第一次提問,希望大神們多多指教!小弟也會虛心受教。
報404狀態碼,表示請求的資源不可用或請求的頁面不存在。你訪問的頁面為admin_index.jsp,而那個web.xml文件設置的為index.jsp,所以你要把web.xml文件的配置改成admin_index.jsp。