0

struts2 appfuse maven プロジェクトに基づいて、個人用の HelloWorld struts2 maven プロジェクトをセットアップしようとしています。

pom.xml、web.xml、struts.xml ファイルで多くのことを簡素化しました。その結果、<welcome-file-list>and<welcome-file>タグが考慮されていないようで、 http://localhost:8080/にアクセスすると、ファイル index.jsp が読み込まれません。次のエラー メッセージが表示されます。

(単語「名前」の後は空白です)

コメントをお待ちしております。

web.xml 内:

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
             org.apache.struts2.dispatcher.FilterDispatcher
            </filter-class>
    </filter>

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

<listener>
    <listener-class>
       org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

struts.xml 内:

<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default"> 
    <action name="Menu">
        <result>/menu/Menu.jsp</result>
    </action>
</package>
4

1 に答える 1

0

struts2 フィルターは、名前が空の "" または "/" パスのアクションを見つけようとしているようです。したがって、ウェルカム リストには到達しません。また、struts.xml に "" & "/" のエントリがありません。つまり、このエラーが発生します。

struts.xml に以下のエントリを追加すると、この問題が解決します。

<action name=""> <result>jsp file path</result></action>
<action name="/"> <result>jsp file path</result></action>
于 2014-02-13T17:24:17.173 に答える