|This article needs additional citations for verification. (September 2015) (Learn how and when to remove this template message)|
2.2.6/ July 21, 2007
|Written in||Java (programming language)|
|License||Apache License 2.0|
WebWork was a Java-based web application framework developed by OpenSymphony that merged into the current Struts2 framework. It was designed to improve developer productivity and simplify code. WebWork was built on top of XWork, which provided a generic command pattern framework as well as an Inversion of Control container.
WebWork provided support for building reusable UI templates, such as form controls, UI themes, internationalization, dynamic form parameter mapping to JavaBeans, client and server side validation, etc.
Design goals and overview
In a standard Java EE web application, the client will typically submit information to the server via a web form. The information is then either handed over to a Java Servlet which processes it, interacts with a database and produces an HTML-formatted response, or it is given to a JavaServer Pages (JSP) document which intermingles HTML and Java code to achieve the same result. Both approaches are often considered inadequate[by whom?] for large projects because they mix application logic with presentation and make maintenance difficult.
WebWork's designers attempted to understand what they regarded as existing frameworks' limitations, and to work to eliminate them. It supports type conversion, continuations, and interceptors. WebWork also supports multiple-view technologies like JSP, velocity, and FreeMarker.
WebWork was designed and implemented with a specific set of goals:
- Web Designer never had to touch Java code
- Create multiple "Web Skins" for an application
- Change Look and Feel
- Change Layout on a given Web Page
- Change Flow among Web Pages
- Move *existing* data elements from one page to another
- Integrate with various backend infrastructures
- Reuse components
- Perform internationalization (i18n) of a web application
- Keep the API small and to the point
- Ability to learn WebWork fast, by making all the fancier features optional
- Allow the developer to choose how to implement as much as possible, while providing default implementations that work well in most cases.
The architecture of WebWork was based on the MVC Framework, Command, and Dispatcher patterns and the principle of Inversion of Control. The life cycle of a WebWork request begins when the servlet container receives a new request. The new request is passed through a set of filters called the filter chain and sent to the FilterDispatcher. The FilterDispatcher forwards the request to the ActionMapper to determine what needs to be done with the request. If the request requires an action, it sends an ActionMapping object back to the FilterDispatcher. If not, ActionMapper returns a null object, indicating that no action needs to be taken. The FilterDispatcher forwards the request and the ActionMapper object to the ActionProxy for further action. The ActionProxy invokes the Configuration File manager to get the attributes of the action, which is stored in the xwork.xml file and creates an ActionInvocation object. The ActionInvocation object contains attributes like the action, invocation context, result, result code, etc. The configuration file manager has access to these configuration files and is used by the ActionProxy as a gateway to the configuration files. The ActionInvocation object also has information about Interceptors that need to be invoked after or before an action is executed.
ActionInvocation invokes all the interceptors listed in the ActionInvocation object and then invokes the actual action. When the action is completed, ActionInvocation gets the action result code from the execution. It uses the action result code to look up the appropriate result, which is usually a JSP page, a velocity template or a freemarker template associated with the result code. ActionInvocation also executes the interceptors again in the reverse order and returns the response as a HttpServletResponse.
WebWork / Struts merger
On November 27, 2005, WebWork developer Patrick Lightbody announced that WebWork would be merging in to Struts2.  While the next major release (WebWork 2.2.x) was released under the WebWork name, all future major revisions (namely, 2.3.x and beyond) would be folded into Struts2.
Ted Husted, developer of Struts said in an email that WebWork was very similar to Struts 1.x and did certain things better than Struts. Both Husted and Lightbody's rationale was that combining WebWork's technology with Struts' community would benefit both projects.
-  Archived March 10, 2008, at the Wayback Machine.
- "Java(TM) Boutique - Review - WebWork: The New Framework on the Block". Javaboutique.internet.com. 2006-03-24. Archived from the original on February 10, 2012. Retrieved 2012-03-06.