こんにちは、Struts に関するチュートリアルhereに従おうとしています。チュートリアルを正確に実行しましたが、HTTP 404 エラーが発生します。このエラーは基本的に、IDE でリソースが見つからないことを意味します。
「ビルド」フォルダーが実際には完全に空であることに気付きました。そのため、プロジェクトの詳細に基づいて実行可能なプロジェクトが自動的に作成されているはずであり、これは実際にサーバーがアプリケーションを実行するために探す場所です。
では、このファイルを手動で生成するにはどうすればよいでしょうか。すべてのリソースをドラッグする必要がありますか? Java クラス、JSP ファイルなど?そうでない場合、自動的にビルドするように構成するにはどうすればよいですか?
乾杯
編集
これを解決するために必要だと思うものを追加しました:
Web.xml lib の隣の WEB-INF フォルダーにあります。
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts2 Application</display-name>
<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>
<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>
Struts.xml Java Resources フォルダー内の resources という名前の src フォルダーにあります。
<?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.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="ApplicationResources" />
<package name="default" extends="struts-default" namespace="/">
<!--
If we changed from the default execute() method, which struts looks for
to say authenticate(), then we would have to specify this in the action
method below like this:
<action
name="login"
method="authenticate"
class="net.viralpatel.struts2.LoginAction">
</action>
-->
<action name="login" class="net.viralpatel.struts2.LoginAction">
<result name="success">Welcome.jsp</result>
<result name="error">Login.jsp</result>
</action>
</package>