Struts2 Dynamic Web Application Sample
- Download and install latest Java Jdk or if installed configure in Eclipse itself
- Download Apache Tomcat server version (9/10) or you can download in Eclipse itself
- Download and install the latest version of Eclipse
- Download essential lib from https://struts.apache.org/download.cgi
(I have installed Eclipse IDE For Enterprise Java and Web Developers)
- Click on Help and then click on “Install New Software”.
- In Work with paste this link: 2022-03 - https://download.eclipse.org/releases/2022-03/ Change the link according to your Eclipse version (2022-03 is version)
- Scroll down to find “Web, XML, Java EE and OSGI Enterprise Development” option and expand it.
- Select the following three options under “Web, XML, Java EE and OSGI Enterprise Development”
- Eclipse Java EE Developer Tools
- Eclipse Java Web Developer Tools
- Eclipse Web Developer Tools
- JST Server Adapters & JST Server Adapters Extension (For Apache Tomcat Server)
- Click next,accept terms install, after everything is installed, restart Eclipse.
- Now you will see on top right "open perespective --> Java EE"
The newer version of Eclipse,generate new project structure that contains a webapp and for me I need WebContent
- New-->Dynamic Web Project-->give name to your project--->click on next button
- Remove src\main\java folder
- And type only src-->click on next button
- Rename Content directory as WebContent-->select generate web.xml deployment descriptor
- Finish.
- After download the struts lib archive,unzip it and copy the lib
- Paste and overwrite the lib in WEB-INF/lib
- Right click on your project-->Targeted Runtimes
- Add new or select if any version is present
In Eclipse, in Servers Tab, you will see "Tomcat vX.X Server at localhost" or it may differ, if you set it up correctly.
- Right click on your Tomcat Server --> Add or Remove
- Add your "project-name" from Available->Configured side.Finish.
- Start the server either by right click on Tomcat Server or on play button to stop do the same and stop
On your browser check http://localhost:8080/samp/ , http://localhost:8080/samp/index.action , http://localhost:8080/samp/hello.action