Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Description

WebWork Out of the box, the framework supports JSP, Velocity, and Velocity FreeMarker for your application presentation layer. Support for other view technologies is easy to add, if needed.

JSP Example

The framework 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: that make it easy to reference framework resources from JavaServer Pages.

Code Block
html
html
titleInput.jsp
<%@ taglib prefix="wwsaf" uri="webwork/action" %>
<html>
<head><title>Webwork<head>
 Form Example</title></head>
<body>
  <title>Cookbook <ww:form name="myForm" action="'formTest'" namespace="/" method="POST">
  <table>- Simple Input Form using Action Properties</title>
    <ww:textfield label="First Name" name="'formBean.firstName'" value="formBean.firstName"/<saf:head/>
</head>

<body>
<saf:form method="POST">
    <ww<saf:textfield label="Last Name" name="'formBean.lastName'" value="formBean.lastNamePlease enter your name" name="name"/>
    <ww<saf:submit value="Save Form"/>
  </table>safform>
</ww:form>body>
</body>html>

The process of events will go as follows:

  1. The client will make request for the page Input.do.
  2. Since the page has an .do extension, the framework
  3. WebWork will take notice since the URI ends in .action (defined in web.xml files)
  4. WebWork will look up the action formTest in its action hierarchy and call any Interceptors that might have been defined.
  5. 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.
  6. The method will process successfully and give WebWork the SUCCESS return parameter.
  7. WebWork will translate the SUCCESS return parameter into the location formSuccess.jsp (as defined in xwork.xml) and redirect accordingly.

...

  1. for Input.
  2. The framework will select the JSP to render.
  3. The JSP will use the saf tags to output fields, labels, hyperlinks, and localized messages.
  4. The client will receive pure HTML to render.