In this post we will explore the features of Struts 2 action class and its capabilities.
Struts2 Actions are the most important and main part of struts2 Framework. They work as Model of MVC framework. Following article gives you more deep idea about Action classes role, configuration etc.
Action class Role:
1. Acts as Model encapsulates the business Logic: The main responsibility of Action class is to include business logic. The business logic will be encapsulated in execute method of the Action class. Read more…
Struts 2 Practical Tutorial:
Following tutorial demonstrates you a simple struts2 application and explains you how things work together in struts2. The tutorial demonstrates sruts2 using a calculator application which calculates different operation results and displays them.
The tutorial uses Eclipse3 IDE - or above.
Step 1: Download struts2
Download struts2-blank-xxx.war from : http://struts.apache.org/download.cgi
Step 2: create a project in eclipse
Create a new Web project in eclipse. (To create webProject click File Menu on top–> select New –> Select Web Project ).
Once you create the application will have src folder and a WebRoot folder. Read more…
Recently for a training I started learning struts2. As I had worked on struts one few years back I started comparing both struts-2 and 1. I found struts2 very easier than struts1.
Though struts 1 was very popular, comparing it with the newer frameworks, which has come into market in last 2 years, struts 1 has some problems.
- ActionForms / Action classes etc – one action needed lots of coding and they were a pain
- Also the action class unit testing was difficult.
- Type conversions were not automatic.
- There was no special feature for AJAX in the framework.. etc
Read more…