what is struts 2 framework .
It is used to develop MVC-based web application .
- Struts can be defined as a web application development framework that is based on
the requests and is used in order to develop the web applications of java enterprise edition (Java EE).
- The Struts2 is an free Open Source web framework based on MVC design pattern. The latest stable version of Struts is Struts2.
It is project of Apache and based on MVC2 architecture. It is combination of WebWork2 and Struts1.
It is highly extensible and flexible framework for web application development.
- The key features of Struts2 are Interceptors, Results, easy integration with other framework through plugins,
data validations at client and server side, implementation of Inversion of Control (IoC), internationalization, and tiles integration etc.
It is a web application framework with tools, and
API for creating web application. It implements Front Controller (FC) approach like - Struts1 and String Web MVC framework.
Any framework provides some common techniques to design either a standalone application,
web application or enterprise application.
- Configuration Files -It contains the configuration information of an application and settings of the application.
It is in XML format and properties file(Key-value). It is an external file which is read at run time. In Struts2 src\struts.xml,
struts.properties and Resource bundled are configuration files.
- Front Controller (FC) -All the request goes from client and response come from server through Front Controller.
It receives the request and processes it based on framework API logic and forwards result to the client for presentation.
No any resources are accessible directly without front controller even static pages. The Struts1 has servlet based front controller (ActionServlet)
and Struts2 has filter based controller (FilterDispatcher).
- View or Presentation Layer-It is user interface, though which user intracts with application.
There are various expression languages are used to develop UI like- Java Server Pages(JSP), JSP Expression Language(JSP-EL),
Java Server Tag Library(JSTL), Object Graph Navigational Language (OGNL), FreeMarker, Velocity etc
- WebWork 2 -The WebWork2 is an Open Source Framework for web application development. It is developed by OpenSymphony and release in Feb2004. It is based on WebWork and XWork framework.
The webwork is fully based on MVC2 architecture and the set of features - Interceptors, Results and Dispatchers. The view page can be developed using JSP, OGNL, Velocity, JsperReport, XSLT and Freemarker.
We can create own template page using JSP and Velocity.