Struts 2.x Netbeans IDE Setup
Struts 2.x is a powerful framework which is used to develop the variety of web applications. It is under the control and management of Apache organization and is available as open source. It provides an 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 http://struts.apache.org/
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 www.netbeans.org 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:
The plugins generally vary depending upon the Netbeans IDE versions. Visit www.netbeans.org 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.
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:
You can change the name of the 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 to 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 glassfish.java.net
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.
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!!