Home | Login | Blog | Forum | Download | RSS Feed | Ajax | Hello-World | J2EE | BPM | EJB | FileNet | Hibernate | ORM | IBM | ILOG | Interview | FAQs |

Java | Apache | JVM | Others | BRMS | Oracle | Pega | SOA | Sun-Certification | Web-Service | websphere | XML |
 

JAVA DEVELOPER SITE - COMPLETE JAVA TUTORIALS

Struts 2 Tutorial,Struts2 Examples,Apache Struts 2 Tutorials


Share
 
 

Useful Java Links


       


Struts2 Framework

 

There are many different web frameworks available for today’s developer. Some of these come from Open Source communities, some from commercial companies, and yet others are internally developed for the current web development needs.

Some of the features that may lead us to consider Struts2:

  • Action based framework
  • Mature with a vibrant developer and user community
  • Annotation and XML configuration options
  • POJO-based actions that are easy to test
  • Spring, SiteMesh and Tiles integration
  • OGNL expression language integration
  • Themes based tag libraries and Ajax tags
  • Multiple view options (JSP, Freemarker, Velocity and

      XSLT)

  • Plug-ins to extend and modify framework features

 

Struts2 is an action based MVC web framework. The Model- View-Controller pattern in Struts2 is realized with five core components – actions, interceptors, value stack / OGNL, result types and results / view technologies.

Following figure shows the  MVC / Struts2 Architecture


strtus tutorial

 

 

The controller is implemented with a Struts2 dispatch servlet filter(FilterDispatcher) as well as interceptors, the model is implemented with actions, and the view as a combination of result types and results.  In Struts 2 the view is commonly implemented using JSP, Velocity Template, Freemaker or some other presentation-layer technology. The value stack and OGNL provide common thread, linking and enabling integration between the other components.

 

Work flow of Struts2 application

Ø  Initial request goes to the Servlet container  which is passed through a standard filter chain. The chain includes the (optional) ActionContextCleanUp filter, which is useful when integrating technologies such as SiteMesh Plugin.  

Ø  Next, the required FilterDispatcher is called, which in turn consults the ActionMapper to  determine if the request should invoke an action.

Ø  If the ActionMapper determines that an Action should be invoked, the FilterDispatcher delegates control to the ActionProxy. The ActionProxy consults the framework   Configuration Files manager (initialized from the struts.xml file).

Ø  Next, the ActionProxy creates an ActionInvocation, which is responsible for the command pattern implementation. This includes invoking any Interceptors (the before clause) in advance of invoking the Action itself.

Ø  Once the Action returns, the ActionInvocation is responsible for looking up the proper result associated with the Action result code mapped in struts.xml. The result is then executed, which often  involves a template written in JSP or FreeMarker to be rendered. While rendering, the templates can use the  Struts tags provided by the framework. Some of those components will work with the ActionMapper to render proper URLs for additional requests.

Ø  Interceptors are executed again (in reverse order, calling the after clause). Finally, the response returns through the filters configured in the web.xml. If the  ActionContextCleanUp filter is present, the FilterDispatcher will not clean up the ThreadLocal ActionContext. If the ActionContextCleanUp filter is not present, the FilterDispatcher will cleanup all ThreadLocals.

The goal of Struts2 is to make web development easier for the developer. To achieve this goal Struts2 provides features to reduce XML configuration via intelligent defaults, utilizes annotations and provides conventions over configuration. Actions are now POJOs (Plain Old Java Objects) which increases testability and reduces coupling in the framework, and HTML form field data is converted to proper types for the action to use. Still further decreasing coupling is request processing has been made more modular by allowing a series of interceptors (custom or Struts2 provided) to provide pre-processing and post-processing functionality. Modularity is a common theme – a plug-in mechanism provides a way to augment the framework; key classes with the framework can be replaced with custom implementations to provide advanced features not provided out of the box; tags can utilize a variety of different rendering  themes (including custom themes); and there are many different result types available for performing after-action execution tasks which include, but are not limited to, rendering JSPs, Velocity and Freemarker templates. And finally, dependency injection is provided via the Spring Framework plug-in with an option for using Plexus, and work underway for PicoContainer.

 

 

 




Download Latest Java/J2EE eBooks, SCJP Dumps, SCWCD Dumps, Pega Tutorial, IBM WebSphere BPM tutorials and many more


If you need any urgent assistance on struts-2-tutorial-for-beginners, kindly email your requirement to us at : info@javagenious.com or Contact-an-Expert. Our experts will try their best to solve your problem.

You can also subscribe to our newsletters on struts-2-tutorial-for-beginners, to receive updates on struts-2-tutorial-for-beginners,via email.Enter you email below:

Enter your email address:

Delivered by FeedBurner



Keyword Tags: struts-2-tutorial-for-beginners tutorial,struts-2-tutorial-for-beginners in java,Concepts of struts-2-tutorial-for-beginners,Java,J2EE,Interview Questions,struts-2-tutorial-for-beginners Examples


Comments:


Post Your Comment:

*

Yes, I would like to recieve email notifications on my reply.

Popular Posts:

 
Popular Downloads

SCJP 1.6 Dumps
JSP Interview Questions
Struts Interview Questions
Hibernate Interview Questions
SCWCD Dumps
SCBCD Dumps

Java/J2EE Tutorial
JMS Tutorials
seam richfaces tutorial
richfaces live demo
jquery example demo
JQuery Tutorial and Source Code
JSF Tutorial
XSL Tutorial
J2EE JMS
CORBA Applications
Java CERTIFICATION
SCJP 1.5
SCJP 1.6
SCWCD 1.5
SCBCD
Mis
Ajax autosuggest autocomplete from database
Struts forms and validation with webflow
Java Apache POI Examples
JDBC Tutorial
Oracle 9i & 10g
MYSQL Tutorial
php Tutorial
JQuery Examples
Upload Java File
JAXB Examples
PL-SQL Tutorial
Dojo AJAX
EJB Examples
Java IDE
Eclipse
NetBeans
IBM Rational Weblogic Workshop
Downloads
SCJP 1.6 Dumps
SCJP 1.5 DUMP
SCJP Material
SCWCD
Java Security
SCBCD Dumps
External Links
SUN Java
JOracle
IBM
PHP Certification
Technical Interview Questions
Amazon Interview Questions
Google Interview Questions
Microsoft Interview Questions
IBM Interview Questions
Yahoo Interview Questions
All Tutorials
php mysql tutorial
SCJP 1.5/1.6
SCWCD 1.5/1.6
Polymorphism
Thread Tutorial
Generics & Exceptions
Spring Struts Hibernate
Java Collections
MAP
SET
LIST
VECTOR
Advanced Java
Stateless Session Bean
Introduction to EJB
Stateful Session Bean
Java Design Patterns
HOME | FORUM | ABOUT | BLOGS | CONTACT-US