EclipseでStruts2環境構築
Eclipse Neonダウンロード
eclipse installerでEclipse IDE for Java Developersをインストール
以下のプラグインを入れる
Spring
Spring IDE
WTP
Eclipse Web Developer
Eclipse JST Server Adapters
Eclipse Java EE Developer Tools
m2e-wtp- Maven Integration for WTPも追加する
Struts2
strutsClipse
StrutsClipse Tilesも追加する
Mavenを入れてソースを取得
Maven入れ方
以下のサイトからBinary zip archiveをダウンロード
https://maven.apache.org/download.cgi
解凍して、任意のディレクトリに置く
解凍したディレクトリのbinフォルダにパスを通す
Maven入れるの終わり。
Mavenを使ってソース取得
mvn archetype:generate -DarchetypeCatalog=http://struts.apache.org/
以下のように聞かれるので6を入力してエンターを押す
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 6
グループIDを聞かれるのでルートパッケージ名をいれる
Define value for property 'groupId':: jp.xxx.test
アーティファクトIDを聞かれるのでプロジェクト名を入れる
Define value for property 'artifactId': :TestProject
バージョンを聞かれるので、何も入れずにエンター
Define value for property 'version': 1.0-SNAPSHOT: :
パッケージ名を聞かれるので、そのままエンター
Define value for property 'package': jp.xxx.test: :
Yか?と聞かれるのでそのままエンター
Y: :
pom.xmlを編集
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2.1-b05</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
EclipseからimportでMavenプロジェクトを開く
Existing Maven Projectを選択し、pom.xmlを選択して取り込む
struts.xmlを編集
<action name="helloWorld" class="helloWorldAction">
<result name="input">/WEB-INF/jsp/index.jsp</result>
<result>/WEB-INF/jsp/helloWorld.jsp</result>
</action>
を以下のように編集する。
<action name="helloWorld" class="jp.xxx.test.HelloWorldAction">
<result name="input">/WEB-INF/jsp/index.jsp</result>
<result>/WEB-INF/jsp/helloWorld.jsp</result>
</action>
サーバーの設定
ViewのServerを開く
右クリックで「Add and Remove」をクリック
今回のプロジェクトをAddする
右クリックでスタートする
Author And Source
この問題について(EclipseでStruts2環境構築), 我々は、より多くの情報をここで見つけました https://qiita.com/Nobuo/items/fb1648997c4a1b5fb525著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .