Struts 2.x Netbeans IDE Setup

Struts 2.x is a powerful framework which is used to develop variety of web applications. It is under the control and management of Apache organization and is available as open source. It provides easy and effective way to develop web applications based on MVC pattern. It makes developers easy to work with Servlet and JSP.

To Know more or to Download Libraries visit

In this post We are going to learn about Struts 2.x Netbeans IDE Integration and to develop and run our first web application using Struts.

Here we will first start with Struts 2.x Netbeans IDE Integration. To perform this, We will go through a series of steps as mentioned below:

Download the following software and plugins:

1. Latest Netbeans IDE from to develop web application.

2. To get the support of struts 2.x in our Netbeans IDE We need to download some plugins for the installed netbeans version.
For Example: If you have downloaded the Netbeans IDE Version 7.2 you have to download the following plugins to get Struts 2.x support in Netbeans 7.2:
a. org-netbeans-modules-framework-xwork.nbm
b. org-netbeans-modules-web-frameworks-struts2.nbm
c. org-netbeans-modules-web-frameworks-struts2lib-v2_0_14.nbm
d. org-netbeans-modules-web-frameworks-struts2lib-v2_2_3.nbm

The plugins generally vary depending upon the Netbeans IDE versions. Visit for any information and download regarding struts 2.x plugin support for Netbeans IDE incase you have error in installing the above plugins in your installed Netbeans IDE.

3. After downloading the plugins for your Netbeans IDE install it in your IDE using the following steps:

a. Click on Tools from the menu options.
b. Click on plugins.
c. Click on downloaded option from the new popped window.
d. Select add plugins and browse through the folders to locate the plugins you have downloaded.
e. The final step is to click on install after adding all the plugins.
f. Ignore and Skip any warnings if received.
f. The IDE will be restarted on its own or will ask to restart.
g. After restarting the IDE, you are ready to develop projects using Struts 2.x framework.

Now it’s time to develop our very first program or web application in Struts using Netbeans as IDE.

1. Click on file option from menu (Menu Bar).
2. Click on New Project
3. Select Java Web. You can find it under categories list (on Left) and Web Application (on Right) in the popped window after selecting the twos click Next.
Struts Netbeans
4. After clicking on next a new window will appear or popped on the screen asking you to enter the project name and location to store the project, by default it will have some values:
Struts Netbeans
You can change the name of project or can leave it as highlighted in blue and simply click on next. Here I have stored in my custom folder on drive D. You can make changes from here or leave it as it is.
5. After clicking on Next in the above point i.e. step 4. You will get a new popped window asking for sever by default it will be having glassfish server (It depends upon the version and type of Netbeans IDE installed).
In this example (See the above screenshot), I have used Apache Tomcat Server. If you can see Glassfish Server leave as it is or in case having no server You have to download and add a server.
To download a Glassfish Server visit
After downloading it, Install it in any directory. After Successful installation using the Netbeans IDE popped up window locate and add the installed glassfish server.

After selecting the server, you can leave the rest as it is and click on next.

6. Here is the last step: You will see Struts 2 option under the Framework only in case of successful plugins integration as mentioned in the beginning of this post.
Struts Netbeans
Select Struts2 option and select create example page as shown in the screenshot. After that Click Finish.

You have successfully created the new project “WebApplication1” (As per the project name mentioned by you).

To run your first Struts 2.x web project:
Right click on “WebApplication1” under projects category on the left of window and click run.
Now you can view your web page in the browser!!

Struts 2.x Tiles Framework (Netbeans IDE) – Part 01

Struts 2.x Tiles Framework (Netbeans IDE) provide us an easy and effective way to manage our web page contents.

Struts 2.x Tiles Framework provide us to make effective and easily maintainable  websites using struts 2.x. With the use of tiles in developing web projects we are able to make and deliver changes in a particular area of page on user’s click for this we don’t need to write the whole page code on all the pages. Just what we need is to integrate our project with tiles framework.

Here is what we need to develop struts 2.x tiles based web project:

1. Create a web project : Visit this link to know “How to Start or Create a new Struts 2.x Web project?“.
2. After Successful creation of the web project. Now click on libraries option present on the left of Netbean IDE window under projects category.
3. In libraries right click on any struts 2.x libraries and in the appeared pop click remove. After doing this removal you will find that all the struts 2.x libraries will be removed.

Now, make sure you have downloaded the following jar files:

  1. commons-beanutils-1.7.0.jar
  2. commons-digester-2.0.jar
  3. commons-fileupload-1.2.2.jar
  4. commons-io-2.0.1.jar
  5. commons-lang-2.5.jar
  6. commons-logging-api-1.1.jar
  7. freemarker-2.3.16.jar
  8. javassist-3.11.0.GA.jar
  9. ognl-3.0.1.jar
  10. struts2-core-2.2.3.jar
  11. struts2-tiles-plugin-2.2.3.jar
  12. tiles-api-2.0.6.jar
  13. tiles-core-2.0.6.jar
  14. tiles-jsp-2.0.6.jar
  15. xwork-core-2.2.3.jar

Before moving ahead make sure you have downloaded all the above mentioned plugins as this plugins are required to build struts 2.x tiles based web applications.’

After you have downloaded these jar files, again right click on libraries and then select add jar files option. A new window pop ups, now locate your downloaded plugins and add all the jar files one by one or all at the same time.

Download all tiles plugins from here

Now click on your root directory and locate and open web.xml file under WEB-INF folder. Add the following code block inside …. You can add it in center-mid after the end of previous code tag and before the start of the new.
1. web.xml configuration:




  2. Now in the same directory where the web.xml file is present create a tiles.xml file by right clicking on WEB-INF folder -> New -> Other -> locate xml folder and select xml document from right name the document as tiles.xml and click on finish.
Add the following code after opening the tiles.xml file:
Save all files!!! Now you are ready to develop struts 2.x tiles programs.
For further information and example visit  Struts 2.x Tiles Framework (Netbeans IDE)- Part(2).