程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> web xml-求助:這個Structs2 登錄demo的action始終無法正常工作

web xml-求助:這個Structs2 登錄demo的action始終無法正常工作

編輯:編程綜合問答
求助:這個Structs2 登錄demo的action始終無法正常工作

錯誤:訪問URL http://localhost:8080/Structs2/login.action

HTTP Status 404 - /Structs2/login.action
type Status report
message /Structs2/login.action

description The requested resource is not available.

代碼:
G:\Workspaces\MyEclipse\Structs2\WebRoot\login.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



username:

password:





<?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">

G:\Workspaces\MyEclipse\Structs2\src\struts.xml



/result.jsp


G:\Workspaces\MyEclipse\Structs2\src\com\action\login\LoginAction.java
package com.action.login;

public class LoginAction {
private String username;
private String password;

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;
}

/**
 * 賦值之後會自動執行
 * @return
 * @throws Exception
 */
public String execute() throws Exception {
    System.out.println("execute()");
    return "success";
}

}

G:\Workspaces\MyEclipse\Structs2\WebRoot\WEB-INF\lib\web.xml
<?xml version="1.0" encoding="UTF-8"?>
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">

struts2
org.apache.struts2.dispatcher.FilterDispatcher

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

跟著網上各種方法都解決不了,但是是跟著浪曦的視頻做的,視頻裡的可以運行,自己的不行,求大神解答

最佳回答:


把你的錯誤信息全部出來貼

zjq78577117
zjq78577117
windking08
windking08
zjq78577117
windking08
windking08
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved