WebWork

Rate WebWork:
Community:1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading …Maturity:1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading …Documentation:1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading …Resources:1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading … Customization:1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading …Integration:1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading …

WebWork is a java framework for developing web applications. WebWork have its own exciting concepts and constructs that make it different from other frameworks. It differentiates itself by providing a way to overcome the limitations of other frameworks. Its features include the model-view-controller design, J2EE font controller and the value stacks, used for assigning values to its custom JSP tags. The unique features of webworks are type conversion, interceptors and continuations.


The basic task of WebWork is to keep things simple that will help in maintaining flexibility. Webwork use the existing web API’s in java instead of hiding or replacing them completely. Nevertheless it does not completely depend on the existing API’s, it has central controller that create action objects. WebWork framework is currently available in version.



WebWork Architecture


WebWork architecture is established on the concepts of MVC, dispatcher patterns, command and inversion control principle. The main architecture of WebWork is shown in the figure.


WebWorks Architecture

WebWork starts by receiving a new request at servlet container. The new request is processed through filter chain that is a set of filters and then it is send to ServletDispatcher, which forward the request to ActionMapper for determining the suitable action. The ServletDispatcher reads a number of configuration files and obtain information that it uses in creating action objects. Action mapping objects task is to handle the request and in response the Action produce response code, this is then manipulate by ServletDispatcher to have the suitable view or to perform a chain of action. If request needs some action it sent the ActionMapping Object to the ServletDispatcher as a response or if no action is required, it response by sending a null object indicating that no action is required.


Requests that need some kind of response, the ServletDispatcher sent such request along with the ActionMapper object to the ActionProxy, here further action is carried out, by invoking the configuration file manager to obtain the action attributes that are stored in xwork.xml file, and it produce the ActionInvocation object. The attributes of ActionInvocation are action invocation context, result, result code etc. these configuration files are accessible by the manager of configuration file and ActionProxy use it in the form of gateway to configuration files. Information that ActionInvocation object contain is about interceptors which are required to be invoked when an action is or is to be executed.


All of the listed interceptors are invoked by ActionInvocation and then the real action is invoked. After the completion of the action, action result code is generated by the execution and sent to ActionInvocation, which then uses the result code for searching the suitable result. The result is usually in the form of JSP page, freemarker template or a velocity template. After obtaining the result ActionInvocation executes the interceptors in inverse manner to response in the form of httpServletResponse.

Validation and Configuration


Validation mechanism of WebWork is different from other frameworks. Formatting, validation and other facilities are handled by creating metadata classes with normal HTML controls. This results in the advancement of HTML elements and they appear as desktop User Interface Widgets.


In configuration WebWork comprises of default property files and there settings can be overridden into another file, called the application-specific properties file. There are number of such properties files used by WebWork, the table below list them with brief explanation.

WebWork properties files:

Properties FileFunctionality
WebworkPrimary Configuration file for frameworks, which includes package name, UI settings and entries pointing to other configuration files.
DefaultDefault property file for WebWorks, containing default values that are read by framework and is overridden selectively for WebWork properties file.
ViewsContains the mapping information of visible resources in specific application. These mappings are for actions and UI elements, action values are stored here, pointing towards the destination resources.
log4jStandard logging file, used for logging in WebWorks.
Action-specificProperties files are mapped to actions, used for handling internationalization. Properties files can be mapped for every action, defining the visual elements required for specific action view.

All these properties files are loaded from class path. WebWork.configuration.properties is a property file that point towards all the required properties files for any application, this mechanism is termed as property loading mechanism. WebWorks check and load each file including default and properties files at startup.

WebWork Features


Tag Libraries
WebWork posses an expansive tag library, depiction of output for users is carried out with the help of this library. WebWork tags are mostly developed to support free marker templates, velocity templates and JSP pages, free marker template is preferred language for WebWorks although it do support the other two languages. There are some tags that are only specific to these languages and can not be used generally. WebWork tags are of two categories, i.e. general tags and HTML tags. General tags are for the manipulation of general flow of UI pages, developers have the facility to include conditional logic in them. Some built-in tags are, if-else, iterator, sort, etc. these help to control output on UI. The built-in tags can be overridden to form new beans, values can be ‘get’ or ‘set’ on these beans, can be pushed to stack, and it also provide facility of internationalization. For the display or access of data on UI, WebWorks provide HTML tags; they help the programmer to use them as an element of templates or themes.


Themes and Templates
Another important feature of WebWorks is its support for themes and templates. Templates are basically small code written in any of the supportable language, these are implemented along with HTML tag libraries. Themes are the combination of similar templates. WebWork has many built-in templates in free marker, and also provide programmers to write their own templates in JSP or velocity. There are such engines present in WebWork that generates these templates in JSP or velocity but the preferred language of WebWork is Free marker. WebWork also have built in themes like templates, and these templates are flexible enough to be extended to form a new theme. The standard package of themes include simple theme, xhtml theme and css-xhtml theme, you can use any of these or can extent them to form a new theme.


Use of Expression Language
Properties of Java object are accessible by an expression language, more precisely Object Graph Navigation Language (OGNL). WebWork use OGNL for accessing of java objects and servlet variables that can be of session scope, application scope or request scope. OGNL is also used for the evaluation of expressions before they are displayed to UI.


Type Conversion
Type information is not defined for the elements in HTML, they are processed as strings. Data could be of any form, integer, data, or double etc, when they are transmitted over HTML, they are considered as strings. Now it is the receiving application task to parse them in their right data type. WebWork has library that is responsible for these conversions. The data of different type is transmitted in as separate fields.


Validation
WebWork has the mechanism for the required validation of data in web forms. These validations are of very basic type for example checking the required fields, data types, date or email format etc. Validators.xml is the file stored in /WEB-INF/classes directory of the web application that performs these basic checks, and is written in XML. Complex validations including user defined validations can also be performed in WebWorks and they depend on ONGL expressions. The ONGL expression can either be directly used in application or in case the required validation can not be performed by built in validators, they can be defined by the programmer in validators.xml file.


Continuation
One of the interesting features of WebWorks is continuation, which lacks in most of the frameworks. This feature provides the facility, to pause a task and then continue it after words. In case there are number of forms to be filled and further processing will be carried out after receiving the complete data, continuation feature provide the facility of pausing the task after completion of one form and then continue the process from where it was stopped. Currently this feature is new and not in frequent use.


Interceptors
Interceptor objects are used to interrupt an on going process and to include the similar functionality. They can be processed before or after the invocation of action or both. They can be created by combining the commonly executed code in a separate reusable class. The execution of current action can be blocked by interceptors and then exceptions are triggered for invalid request, which result in the failure of execution method. The basic interceptor functionality is to check either a user is login or not, cleaning of request or response parameters, checking for duplicates submission of forms etc.



WebWorks provide some built-in utilities for developing and debugging. These utilities include:



  1. Problems related to the configuration at run time or debug time can be identified by config browser.
  2. Web application flow can be checked through a UI flow termed as SiteGraph. It is beneficial for maintenance and development.
  3. To include the samples without compiling or deploying, WebWork provides the utility of QuickStart.
  4. WebWork can easily be integrated to third party software, just by doing certain configuration changes.

Similar Frameworks


WebWork can be integrated with Struts; one of the examples is Struts Action 2.0. It has the best features of both frameworks, and the unique features of WebWork are still present in it.

Good things about WebWork



  1. WebWorks have many out-of-the-box functionality, and it get effected by user’s action, but relatively less as compared to other frameworks.
  2. Actions are not coupled with web and any depth of actions can be taken.
  3. WebWorks are servlet independent.
  4. Form beans are not required, if you need to use them you can.
  5. WebWork is a good MVC framework.

Bad things about WebWork


The bad thing about WebWork is the use of WebWork macro languages, they are complex and customization becomes difficult. WebWork publisher has long generation time and it undergo project rescanning, these things make processing very time consuming. And also WebWork do not provide any preview option for viewing page before generation.

Leave a comment