Setting Up Struts 2 in Eclipse

You can proceed to setup your Struts 2 framework. Following are the simple steps to download and install Struts2 on your machine.

Step 1:

  • Make a choice whether you want to install Struts2 on Windows, or Unix and then proceed to the next step to download .zip file for windows and .tz file for Unix.
  • Download the latest version of Struts2 binaries from http://struts.apache.org/download.cgi.
  • At the time of writing this tutorial, I downloaded struts-2.3.15-all.zip and when you unzip the downloaded file it will give you directory structure inside D:personal dataStruts 2 videostruts-2.3.15 as follows.
Setting Up Struts 2 in Eclipse


Step 2: Second step is to extract the zip file in any location, I downloaded & extracted struts-2.3.15-all.zip in D:personal dataStruts 2 video  folder on my Windows 7 machine so that I have all the jar files into D:personal dataStruts 2 videostruts-2.3.15lib. Make sure you set your CLASSPATH variable properly otherwise you will face problem while running your application.

Step 3:  Now Open your eclipse environment.

Setting Up Struts 2 in Eclipse

Step 4: Click on Files->New->Other

Setting Up Struts 2 in Eclipse

Step 5:  Click on web->Dynamic web project->next

Setting Up Struts 2 in Eclipse

Write your project Name in the text box. I have written “Strut2MyFirstApp
Now here, I am assuming you have apache tomcat 7 server installed in your machine. If you
have target runtime as none then you can refer configure Apache Tomcat in STS IDE.
Now click on Finish button.

Step 6: Now go to location where you have download strut2 package and open lib
folder.you can have all jars but for now you can copy following jars

  • struts2-core-2.3.15
  • xwork-core-2.3.15
  • ognl-3.4
  • commons-io-2.0.1
  • commons-fileupload-1.2.2
  • javassist-3.11.0.GA
  • freemarker-2.3.18
  • commons-lang-2.5
  • commons-logging-1.1.1
  • commons-logging-api-1.1
  • struts2-dojo-plugin-2.3.15.jar

Step 7: Paste all above copied jars to WebRoot->WEB-INF->lib

Setting Up Struts 2 in Eclipse

Step 8: Add all these jars to eclipse build path.
Right click on project(Strut2MyFirstApp)->properties

Setting Up Struts 2 in Eclipse

Step 9: go to project->WebContent->WEB-INF->lib and select all jars then click on ok.

Step 10: Click on ok.
Now you are done with configuring strut2 in eclipse.You can create your struts 2 project.

 

<<Previous <<   || Index ||   >>Next >>
Previous
Next