Struts 2 FrameWork Tutorial
A framework tries to automate the common tasks and provides a platform for the users to build applications quickly.
Struts 2 is based on the OpenSymphony Web Works Framework.
Struts 2 framework implements the Model-View-Controller (MVC) design pattern.
In Struts 2 the model, view and controller are implemented by the action, result and FilterDispatcher respectively.
The controller's job is to map the user request to appropriate action.
In Struts 2 FilterDispatcher does the job of Controller.
Model contains the data and the business logic.
In Struts 2 the model is implemented by the Action component.
View is the presentation component of the MVC Pattern.
In Struts 2 the view is commonly implemented using JSP, Velocity Template, Freemaker or some other presentation-layer technology.
The controller receives the user request and determine which Struts 2 action to invoke.
The framework creates an instance of this action and associate it with the newly created instance of the ActionInvocation.
In Struts 2 the invocation of action should pass through a series of interceptors as defined in the application's XML file.
The framework calls the ActionInvocations invoke() method to start the execution of the action.
Each time the invoke() method is called, ActionInvocation consults its state and executes whichever interceptor comes next.
ActionInvocation hands control over to the interceptor in the stack by calling the interceptors intercept() method.
The intercept() method of the interceptor inturn calls the invoke() method of the ActionInvocation till all the interceptors are invoked, in the end the action itself will be called and the corresponding result will be returned back to the user.
Some interceptor do work before the action is executed and some do work after the action is executed. It's not necessary that it should do something each time it is invoked.
These interceptors are invoke both before and after the action.
First all the interceptors are executed in the order they are defined in the stack.
Then the action is invoked and the result is generated.
Again all the interceptors present in the stack are invoked in the reverse order.
The other important features of Struts 2 are ONGL and ValueStack.
Object-Graph Navigation Language (OGNL) is a powerful expression language that is used to reference and manipulate data on the ValueStack.
OGNL help in data transfer and type conversion.
OGNL expression language provides simplified stytax to reference java objects.
OGNL is used to bind the java-side data properties to the string-based view layer.
In Struts 2 the action resides on the ValueStack which is a part of the ActionContext. ActionContext is a global storage area that holds all the data associated with the processing of a request.
When a request comes the params interceptor helps in moving the request data to the ValueStack.
Now the OGNL does the job of converting the string based form data to their corresponding java types. OGNL does this by using the set of available built-in type converters.
Again when the results are generated the OGNL converts the java types of the property on the ValueStack to the string-based HTML output.
ActionContext is thread local which means that the values stored in the ActionContext are unique per thread, this makes the Struts 2 actions thread safe.
分享到:
相关推荐
Java Struts Spring Hibernate Tutorial
The book aims to explain the concepts of the Entity Framework and illustrate how you can use these in applications with a tutorial based approach. Table of Contents Chapter 1: Introducing the ADO...
Robot Framework Tutorial 2016 Part 1: Installation Part 2: Keywords Part 3: Implementing Keywords in Java Part 4: Selenium2Library as a drop-in replacement for SeleniumLibrary Part 5: Integration with...
Struts 2 Design and Programming A Tutorial
针对Struts1的网页版的Struts Design and Programming A Tutorial
django-rest-framework-tutorial 算是翻译的比较好的资料 跟着官网上做不理解,好不容易找到的资料
NULL 博文链接:https://xifangyuhui.iteye.com/blog/716217
Struts2 Design and Programming: A Tutorial.pdf 是一本介绍Struts2的设计和编程思想的书,也可以作为一本手册来使用
2.Installation of Struts 3.The First Try: Simple JSP 4.Second Try: Struts For Internationalisation 5.Struts for Forms 6.Struts: Introducing the ActionForm 7.A better way to seperate Book ...
struts_2_tutorial; 入门教程(全英文版);
自己费力将 vaannila上的tutorial网页全打印下来了为pdf格式,你们可以自己去弄, 不过很费时间。
Struts Tutorial
struts tutorial.pdf
struts2.3 tutorial of pdf format English edition
Java Struts Tutorial.pdf
iBATIS-SqlMaps-2-Tutorial_cniBATIS-SqlMaps-2-Tutorial_cn.pdf.pdfiBATIS-SqlMaps-2-Tutorial_cn.pdfiBATIS-SqlMaps-2-Tutorial_cn.pdf
first_struts_tiles_tutorial 很好的资料,关于踢tile的资料是在是难找啊 英文版,慎下
The ADO.NET Entity Framework, the next generation of Microsoft's data access technology, is an extended Object Relational Mapping (ORM) technology that makes it easy to tie together the data in your ...
2. How To Use This Manual Depending on your familiarity with computational fluid dynamics and the ANSYS Fluent software, you can use this tutorial guide in a variety of ways. 2.1. For the Beginner If ...