これについてのさらに別の質問は私が知っていますが、私が他のすべてまたは周りを見たとだけ言いましょう。そのため、現在、Struts2プロジェクトの構造を構築しています。Struts 2.3.4、JBoss 7.1、EclipseIndigoを使用しています。また、必要なすべてのjarをプロジェクトに含めました。問題は、アプリケーションを実行して(Jbossにプロジェクトを追加し、サーバー上で実行)、「http:// localhost:8080 / booxstore /」に移動すると、次のようになります。
Etat HTTP 404 - There is no Action mapped for namespace [/] and action name [] associated with context path [/booxstore]
私のweb.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>Booxstore</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
私の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.devMode" value="false" />
<package name="pages" namespace="/pages" extends="struts-default">
<action name="afficher" class="com.booxstore.controller.DisplayAction" >
<result name="SUCCESS">/center.jsp</result>
</action>
</package>
</struts>
私の行動:
/**
*
*/
package com.booxstore.controller;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
public class DisplayAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 8199854978749642334L;
public String execute() throws Exception{
System.out.println("IN");
return Action.SUCCESS;
}
}
私のJSPにはプレーンテキストがあり、Struts2タグをインポートしています。基本的に何をしてもリソースが取れません。「http:// localhost:8080 / booxstore /」または「http:// localhost:8080 / booxstore / DisplayAction」にアクセスすると、「アクションがマップされていません」と表示され、jspに直接アクセスしようとすると次のようになります。 404。私の戦争はサーバーにデプロイされて有効になっていることに注意してください。