Description
WebWork supports JSP and Velocity for your application presentation layer. For this example we will use a JSP file. Webwork comes packaged with a tag library (taglibs). You can use these taglibs as components in your JSP file. Here is an section of our form.jsp page:
<%@ taglib prefix="ww" uri="webwork" %>
<html>
<head><title>Webwork Form Example</title></head>
<body>
<ww:form name="myForm" action="'formTest'" namespace="/" method="POST">
<table>
<ww:textfield label="First Name" name="'formBean.firstName'" value="formBean.firstName"/>
<ww:textfield label="Last Name" name="'formBean.lastName'" value="formBean.lastName"/>
<ww:submit value="Save Form"/>
</table>
</ww:form>
</body>
The process of events will go as follows:
- WebWork will take notice since the URI ends in .action (defined in web.xml files)
- WebWork will look up the action formTest in its action hierarchy and call any Interceptors that might have been defined.
- WebWork will translate formTest and decide to call the method processForm in the class com.opensymphony.webwork.example.FormAction as defined in xwork.xml file.
- The method will process successfully and give WebWork the SUCCESS return parameter.
- WebWork will translate the SUCCESS return parameter into the location formSuccess.jsp (as defined in xwork.xml) and redirect accordingly.
Most of the content here provided by Matt Dowell <matt.dowell@notiva.com>
|