“Hello, World” Web Application using Struts 2 in NetBeans IDE 6.1
This tutorial guides you through the process of creating and running a basic "Hello, World" Struts 2 web application using the NetBeans IDE 6.1.
NOTE: I recommend trying to follow the NetBeans tutorial on the Struts 2 website first. If you find any problems following it, then come back to my tutorial. I have tried to make this more beginner friendly by including a lot of screenshots.
Download/Install Java SE, NetBeans and Struts 2


Don't select any frameworks, especially Struts 1.2.9, to be added to the project.
Add Struts 2 Libraries to Web Application project in NetBeans and configure web.xml file

In the Add JAR/Folder file chooser dialog box, browse to the extracted Struts 2 directory, go to lib directory in it and select all the JAR files that you want to add to the project. Hold down the Ctrl button to select multiple files.

The following JAR library files are essential for most Struts 2 projects(and for this tutorial) but you can select more if you know that you need them(you can add additional libraries later also):
Libraries folder in your project will now look like this:

You can enter the same data in Filters tab also:

Create Struts 2 action Java class and JSP result page and configure struts.xml file
Edit struts.xml file such that it has the following content:
This maps the requests sent to the "/HelloStruts2World.action" url to HelloStruts2World.java Struts 2 action and after the successful execution of the request, it gets directed to the index.jsp result page. Leave the struts.properties file empty for now.
Let us access the message property set by HelloStruts2World action and display it in the index.jsp page. Edit index.jsp so that it looks like this:Run the Struts 2 Web Application Project in NetBeans 6.1 IDE


Other Options:
This is the manual way to develop Struts 2 web applications in the NetBeans IDE but it is at least more beginner friendly than working from the command line using just the Maven build tool. There is a Struts 2 plugin called nbstruts available for NetBeans; its functionality is currently limited but it is under active development. Other popular alternative IDEs for developing web applications using Struts 2 are Eclipse and IntelliJ IDEA.












