Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Struts is a flexible control layer based on standard technologies like Java Filters, JavaBeans, ResourceBundles, Locales, and XML, as well as various OpenSymphony packages, like OGNL and XWork.

For the Model, the framework can interact with standard data access technologies, like JDBC and EJB, as well as most any third-party packages, like Cayenne, Hibernate, or iBATIS.

For the View, the framework works well with JavaServer Pages, including JSTL and JSF, as well as FreeMarker or Velocity Templates, PDF, XSLT, and other presentation systems.

Aside from actions and results, we can specify exception handlers and interceptors.

  • Exception handlers declare how to handle an exception on a global or local basis. Instead of sprinking source code with try .. catch blocks, we can let the framework catch the exception and display the page of our choice. The page can display an appropriate message and details from the exception.
  • Interceptors specify the "request-processing lifecycle" for an action. (What happens to the request before and after the Action class fires.) We can specify both global and local lifecycles. If some actions respond to AJAX, SOAP, or JSF requests, we can simplify the lifecycle, and even just "pass through" the request, if needed. However, these are special cases, and most applications can use the default interceptor stack, "out of the box".

The diagram describes the framework's architecture.

...

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.

Aside from interceptors, actions, and results, we can also specify exception handlers.

  • Exception handlers declare how to handle an exception on a global or local basis. Instead of sprinking source code with try .. catch blocks, we can let the framework catch the exception and display the page of our choice. The page can display an appropriate message and details from the exception.

Next:

...

AJAX