Figure 1.1. The Java Servlet API exposes the HTTP client/server protocol to the Java platform. Struts 2 is built on top of that.
|
For web applications, HTTP has two hurdles to get over. It’s stateless, and it’s text based.
Don’t reinvent the wheel
FilterDispatcher: early version
Figure 1.4. Struts 2 request processing uses interceptors that fire before and after the action and result.
the ValueStack is a storage area that holds all of the data associated with the processing of a request.
The ActionContext contains all of the data that makes up the context in which an action occurs. This includes the ValueStack but also includes stuff the framework itself will use internally, such as the request, session, and application maps from the Servlet API.
OGNL is a powerful expression language (and more) that is used to reference and manipulate properties on the ValueStack.
Typically, it is considered bad form to obtain the contents of the ActionContext yourself. The framework provides many elegant ways to interact with that data without actually touching the ActionContext, or the ValueStack, yourself. Primarily, you’ll use OGNL to do this.
Figure 2.6. Anatomy of a URL: mapping a URL namespace to a Struts 2 action namespace