Commits

plightbo  committed 5c1dd84

getting ready for 2.1.1

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@513573baa09-0c28-0410-bef9-dab3c582ae83

  • Participants
  • Parent commits 191c797

Comments (0)

Files changed (37)

File docs/wikidocs/Documentation.html

 				    </div>
 
 				    <p class="paragraph"><h3 style="margin: 4px 0px 4px 0px;" class="heading3"><a name="Documentation-1.Overview"> 1. Overview</a></h3></p><ol>
-<li> <a href="What is WebWork.html" title="What is WebWork">What is WebWork</a></li>
+<li> <a href="What is Webwork.html" title="What is WebWork">What is WebWork</a></li>
 <li> <a href="Getting Started.html" title="Getting Started">Getting Started</a></li>
 <li> <a href="FAQ.html" title="FAQ">FAQ</a></li>
 <li> <a href="Deployment Notes.html" title="Deployment Notes">Deployment Notes</a></li>
 </ol>
 <h3 class="heading3"><a name="Documentation-5.Thirdpartyintegration"> 5. Third-party integration</a></h3>
 <ol>
-<li> <a href="SiteMesh.html" title="SiteMesh">SiteMesh</a></li>
+<li> <a href="Sitemesh.html" title="SiteMesh">SiteMesh</a></li>
 <li> <a href="Spring.html" title="Spring">Spring</a></li>
 <li> <a href="Pico.html" title="Pico">Pico</a></li>
 <li> <a href="Hibernate.html" title="Hibernate">Hibernate</a></li>

File docs/wikidocs/Sitemesh.html

+<html>
+    <head>
+        <title>WebWork 2 : SiteMesh</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : SiteMesh
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 26, 2004 by <font color="#0050B2">mbogaert</font>.
+				    </div>
+
+				    <p class="paragraph">SiteMesh can be found at <a href="http://www.opensymphony.com/sitemesh" title="Visit page outside Confluence">&#104;ttp://www.opensymphony.com/sitemesh</a></p>Integrating WebWork with SiteMesh is amazingly simple: you don&#039;t have to do anything in fact. WebWork stores all its value stack information in the request attributes, meaning that if you wish to display data that is in the stack (or even the ActionContext) you can do so by using the normal tag libraries that come with WebWork. That&#039;s it!<p class="paragraph">One thing to note is when you want to pass a value from a decorated page to a decorator using the <b class="strong">&lt;ww:set&gt;</b> tag, you need to specify a scope (request, session, application) if the decorated page is invoked directly (not a result of an action).  By default if no action has been executed and no scope was specified, the set value will only availlable from the same PageContext.</p>
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/Spring.html

+<html>
+    <head>
+        <title>WebWork 2 : Spring</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : Spring
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 09, 2004 by <font color="#0050B2">ctran</font>.
+				    </div>
+
+				    <p class="paragraph"><h2 style="margin: 4px 0px 4px 0px;" class="heading2"><a name="Spring-WhatisSpringandWhydoyouwanttouseitwithWebWork%3F"> What is Spring and Why do you want to use it with WebWork?</a></h2>
+Check out <a href="http://www.springframework.org" title="Visit page outside Confluence">&#104;ttp://www.springframework.org</a> for more details about Spring.  To summarize,  Spring provides several different layers. Spring&#039;s IoC container, for instance, provides a nice transparent way to wire together objects with their dependencies, such as services they use. It can also, with the help of its AOP framework, provide transactional behavior to plain Java beans. Spring also provides an MVC framework, which is what could be compared to WebWork.  There are those who believe WebWork is a better MVC framework, and so would choose WebWork for this part and integrate the rest of the Spring stack.
+<br clear="all" />
+There are a number of ways to integrate Spring into WebWork.</p><h2 class="heading2"><a name="Spring-UseSpringObjectFactory"> Use SpringObjectFactory</a></h2><p class="paragraph">The <a href="http://xwork-optional.dev.java.net" title="Visit page outside Confluence">xwork-optional</a> package from dev.java.net contains a module <b class="strong">xwork-spring</b> that contains all the necessary code to use Spring in WebWork.  It contains primarily a SpringObjectFactory to wire up the dependencies for an Action before passing it to WebWork. Each action should be configured within a Spring application context as a prototype (because WebWork assumes a new instance of a class for every action invocation).  Specify something like this in applicationContext.xml:
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;bean name=<span class="xml&#45;quote">&quot;some&#45;action&quot;</span> class=<span class="xml&#45;quote">&quot;fully.qualified.class.name&quot;</span> singleton=<span class="xml&#45;quote">&quot;false&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;property name=<span class="xml&#45;quote">&quot;someProperty&quot;</span>&gt;</span><span class="xml&#45;tag">&lt;ref bean=<span class="xml&#45;quote">&quot;someOtherBean&quot;</span>/&gt;</span><span class="xml&#45;tag">&lt;/property&gt;</span>&#10;<span class="xml&#45;tag">&lt;/bean&gt;</span></pre>
+</div></div></p>and in xwork.xml:
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;myAction&quot;</span> class=<span class="xml&#45;quote">&quot;some&#45;action&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span>&gt;</span>view.jsp<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;<span class="xml&#45;tag">&lt;/action&gt;</span></pre>
+</div></div><p class="paragraph">Notice that the WebWork Action&#039;s class name <b class="strong">some-action</b> is the bean name defined in the Spring application context.</p>Another advantage of the SpringObjectFactory approach is that it can also be used to load interceptors using the same sort of logic. If the interceptor is stateless, then it&#039;s possible to create the interceptor as a singelton instance, but otherwise it&#039;s best to create it as a Spring prototype. 
+<br clear="all" />
+In order to be used, the default ObjectFactory that WebWork uses should be replaced with an instance of the SpringObjectFactory. The xwork-optional package ships with a ContextListener that does this, assuming that the Spring application context has already been configured.  Add the following to web.xml:
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; This needs to be after Spring ContextLoaderListener &#45;&#45;&gt;</span></span>&#10;<span class="xml&#45;tag">&lt;listener&gt;</span>&#10;  <span class="xml&#45;tag">&lt;listener&#45;class&gt;</span>com.opensymphony.xwork.spring.SpringObjectFactoryListener<span class="xml&#45;tag">&lt;/listener&#45;class&gt;</span>&#10;<span class="xml&#45;tag">&lt;/listener&gt;</span></pre>
+</div></div><p class="paragraph">Note: this is actually a XWork configuration but for simplicity, I just assume WebWork.</p>
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/Templates.html

+<html>
+    <head>
+        <title>WebWork 2 : Templates</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : Templates
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 16, 2004 by <font color="#0050B2">casey</font>.
+				    </div>
+
+				    <p class="paragraph"><h3 style="margin: 4px 0px 4px 0px;" class="heading3"><a name="Templates-Overview"> Overview</a></h3></p>In WebWork, the UI tags wrap generic HTML controls while providing tight integration with the core framework. The tags have been designed to minimize the amount of logic in compiled code and delegate the actual rendering of HTML to a template system. Templates can be grouped together and seperated into different <a href="themes.html" title="Themes">themes</a>.  The UI tags attempt to cover the most common scenarios, while providing a Component Tag for creating custom components. The UI tags also provide built-in support for displaying inline error messages.
+<h4 class="heading4"><a name="Templates-Templates"> Templates</a></h4><p class="paragraph">WebWork uses the Velocity template system to render the actual HTML output for all UI tags (jsp and velocity). A default implementation of all templates has been included with the core distribution allowing users to use WebWork&#039;s UI tags &quot;out of the box&quot;. Templates can be edited individually or replaced entirely allowing for complete customization of the resulting HTML output. In addition, the default template can be overridden on a per tag basis allowing for a very fine level of control.</p>The templates can be found in the distribution package in a directory called <tt class="monospaced">template</tt> under the <tt class="monospaced">src</tt> directory or in the webwork-x.x.jar file.  Copy the template directory into the root directory of your application.  Otherwise, webwork will load the templates in the jar file.
+<div class="code"><div class="codeContent">
+<pre>/myApp&#10;      /META&#45;INF&#10;      /WEB&#45;INF&#10;      /template</pre>
+</div></div><p class="paragraph">Inside the <tt class="monospaced">template</tt> directory, you will find two template sets called <a href="Themes.html" title="Themes">Themes</a> (xhtml and simple).  The default template set that is used with UI tags is <a href="Themes.html#Themes-xhtml" title="xhtml on Themes">xhtml</a> unless specified by the theme attribute in your UI tag or in the <a href="webwork.properties.html" title="webwork.properties">webwork.properties</a> file with the webwork.ui.theme variable.  You can modify the pre-existing templates or create your own.</p>The AbstractUI class is the base class that other UI tags extend. It provides a set of attributes that are common across UI components. The AbstractUI class defines an abstract method:<br/>
+
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">protected</span>&#160;<span class="java&#45;keyword">abstract</span>&#160;<span class="java&#45;object">String</span> getTemplateName();</pre>
+</div></div><p class="paragraph">The AbstractUI class will load the template specified by the subclass or optionally, a template specified by the user using the template attribute.  The following will load myOwnTextTemplate.vm for the textfield UI tag instead of the built in template text.vm</p><ins class="inserted">NOTE:</ins> You have to create a template file called myOwnTextTemplate.vm and store it in xhtml for this to work.
+<div class="code"><div class="codeContent">
+<pre>&lt;&#33;&#45;&#45; loads /template/xhtml/myOwnTextTemplate.vm &#45;&#45;&gt;&#10;&#10;&lt;ww:ui textfield label=&#148;&#146;mylabel&#146;&#148; name=&#148;&#146;myname&#146;&#148; template=&#148;&#146;myOwnTextTemplate.vm&#146;&#148; /&gt;</pre>
+</div></div><br/>
+otherwise
+<div class="code"><div class="codeContent">
+<pre>&lt;&#33;&#45;&#45; loads <span class="java&#45;keyword">default</span> /template/xhtml/text.vm &#45;&#45;&gt;&#10;&lt;ww:ui textfield label=&#148;&#146;mylabel&#146;&#148; name=&#148;&#146;myname&#146;&#148; /&gt;</pre>
+</div></div><p class="paragraph"><h4 class="heading4"><a name="Templates-Builtintemplates%3Caname%3D%22TemplatesdefaultTemplates%22%3E%3C%2Fa%3E"> Built in templates <a name="Templates-defaultTemplates"></a></a></h4></p>The default templates that correspond to each UI tag are as follows:
+<table class="wikitable">
+<tr>
+<th> UI tag  </th><th> default template </th>
+</tr><tr>
+<td> checkboxList </td><td> checkboxlist.vm </td>
+</tr><tr>
+<td> checkbox </td><td> checbox.vm </td>
+</tr><tr>
+<td> combobox </td><td> combobox.vm </td>
+</tr><tr>
+<td> component </td><td> empty.vm </td>
+</tr><tr>
+<td> doubleSelect </td><td> doubleselect.vm </td>
+</tr><tr>
+<td> file </td><td> file.vm </td>
+</tr><tr>
+<td> form </td><td>	form.vm(to open) <br clear="all" />
+form-close.vm(to close) </td>
+</tr><tr>
+<td> hidden </td><td> hidden.vm </td>
+</tr><tr>
+<td> label </td><td> label.vm </td>
+</tr><tr>
+<td> password </td><td> password.vm </td>
+</tr><tr>
+<td> radio </td><td> radiomap.vm </td>
+</tr><tr>
+<td> select </td><td> select.vm </td>
+</tr><tr>
+<td> submit </td><td> submit.vm </td>
+</tr><tr>
+<td> tabbedpane </td><td> tabbedpane.vm </td>
+</tr><tr>
+<td> textarea </td><td> textarea.vm </td>
+</tr><tr>
+<td> textfield </td><td> text.vm </td>
+</tr><tr>
+<td> token </td><td> token.vm </td>
+</tr>
+</table>
+<h4 class="heading4"><a name="Templates-Accessingvariables"> Accessing variables</a></h4><p class="paragraph">A VelocityContext object is created and used by all WW velocity views with the following context parameters:</p><ul class="star">
+<li> tag - a reference to the tag object</li>
+<li> stack - the current OgnlValueStack</li>
+<li> ognl - a reference to the utility class OgnlTool</li>
+<li> req - a reference to the HttpServletRequest object</li>
+<li> res - a reference to the HttpServletResponse</li>
+<li> webwork - instance of WebWorkUtil</li>
+<li> action - the current Webwork action</li>
+<li> parameters - map of the current parameters</li>
+</ul><br/>
+These variables can be accessed in the template by using $TAG_NAME where TAG_NAME is one of tag, stack, ognl, req, ...). The template file is then processed.  A few examples:<br/>
+<ins class="inserted">NOTE:</ins> The bang (&#33;) will print the value if its defined and &quot;&quot; if its not
+<div class="code"><div class="codeContent">
+<pre>$&#33;req.requestURI&#10;$&#33;req.method</pre>
+</div></div><br/>
+
+<div class="code"><div class="codeContent">
+<pre>$&#33;tag.templateDir&#10;$&#33;tag.theme</pre>
+</div></div><br/>
+
+<div class="code"><div class="codeContent">
+<pre>$&#33;parameters.name&#10;$&#33;parameters</pre>
+</div></div><p class="paragraph"><h4 class="heading4"><a name="Templates-UnderstandingtheWebworkTemplateSystem%3Caname%3D%22Templateswebworktemplatesystem%22%3E%3C%2Fa%3E"> Understanding the Webwork Template System <a name="Templates-webworktemplatesystem"></a></a></h4></p>Look at how the template is found and loaded.  A peek into AbstractUITag shows us the string used to build the template:
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">protected</span>&#160;<span class="java&#45;object">String</span> buildTemplateName(<span class="java&#45;object">String</span> myTemplate, <span class="java&#45;object">String</span> myDefaultTemplate) &#123;&#10;        ...&#10;        <span class="java&#45;keyword">return</span>&#160;<span class="java&#45;quote">&quot;/&quot;</span> &#43; getTemplateDir() &#43; <span class="java&#45;quote">&quot;/&quot;</span> &#43; getTheme() &#43; <span class="java&#45;quote">&quot;/&quot;</span> &#43; template;&#10;&#125;</pre>
+</div></div><br/>
+With the defaults, this will return the string for the textfield UI tag
+<div class="code"><div class="codeContent">
+<pre>/template/xhtml/text.vm</pre>
+</div></div><br/>
+Webwork will attempt to find these values before it uses the default ones.  You don&#039;t have to override any values and can modify the built in templates if you so desire(your choice).  Webwork searches for these values in the order they are listed:
+<ul class="star">
+<li> getTemplateDir()<ul class="star">
+<li> webwork.ui.templateDir value in webwork.properties</li>
+<li> otherwise, &quot;template&quot; is returned</li>
+</ul></li>
+<li> getTheme()<ul class="star">
+<li> in UI tag theme attribute</li>
+<li> webwork.ui.theme value in webwork.properties</li>
+<li> otherwise, &quot;xhtml&quot; is returned</li>
+</ul></li>
+<li> template<ul class="star">
+<li> in UI tag template attribute</li>
+<li> otherwise, defaults to specified template(see <a href="#Templates-defaultTemplates" title="defaultTemplates on Templates">defaults</a>)</li>
+</ul></li>
+</ul><p class="paragraph"><h4 class="heading4"><a name="Templates-TemplateswithCSS"> Templates with CSS</a></h4></p>The default templates define several properties for use with CSS when HTML is generated from webwork tags.   These properties can be found in a stylesheet located in the /template/xhtml directory called <tt class="monospaced">styles.css</tt>.  You can use this stylesheet as a skeleton for your application and build on it or create your own, but remember you must include a link to the stylesheet within your jsp or velocity page.<br/>
+styles.css:
+<div class="code"><div class="codeContent">
+<pre>.label &#123;font&#45;style:italic; &#125;&#10;.errorLabel &#123;font&#45;style:italic; color:red; &#125;&#10;.errorMessage &#123;font&#45;weight:bold; text&#45;align: center; color:red; &#125;&#10;.checkboxLabel &#123;&#125;&#10;.checkboxErrorLabel &#123;color:red; &#125;&#10;.required &#123;color:red;&#125;&#10;.requiredLabel &#123;font&#45;weight:bold; font&#45;style:italic; &#125;</pre>
+</div></div><br/>
+referencing the stylesheet with a link inside your webpage (relative path or you can specify it from the root of your container):
+<div class="code"><div class="codeContent">
+<pre>&lt;link rel =<span class="java&#45;quote">&quot;stylesheet&quot;</span> type=<span class="java&#45;quote">&quot;text/css&quot;</span> href=<span class="java&#45;quote">&quot;/webwork&#45;example/template/xhtml/styles.css&quot;</span> title=<span class="java&#45;quote">&quot;Style&quot;</span>&gt;</pre>
+</div></div><p class="paragraph"><ins class="inserted">Note:</ins> Webwork now has new attributes in the UI tags for more generic support of HTML styles and classes to make the look and feel even more flexible to implement.  These are defined respectively as cssStyle and cssClass.
+<div class="code"><div class="codeContent">
+<pre>&lt;ui:textfield label=<span class="java&#45;quote">&quot;&#039;lebal&#039;&quot;</span> name=<span class="java&#45;quote">&quot;&#039;nmae&#039;&quot;</span> cssStyle=<span class="java&#45;quote">&quot;&#039;<span class="java&#45;object">float</span>:left; color:red&#039;&quot;</span> cssClass=<span class="java&#45;quote">&quot;&#039;myclass&#039;&quot;</span>   /&gt;</pre>
+</div></div></p><h4 class="heading4"><a name="Templates-CreatingCustomComponents"> Creating Custom Components</a></h4><p class="paragraph">At first glance the component tag doesn&#039;t look that impressive. The ability to specify a single template and use a number of predetermined attributes looks rather lacking. But the supplied tag offers a number of benefits to developers.</p>Before diving right into the custom component, first I will identify some advantages to using the component tag to create your components. Then I will detail the two types of error messages in WebWork 2 and how our custom component (for displaying one of these types) fits into the equation. Finally, I will present a sample Action class, Jsp file and template file for our component. When we are finished, you will be able to incorporate the new component into your application.<p class="paragraph">Why use the component tag?
+<ul class="star">
+<li> removes the need to develop your own Jsp tag library</li>
+<li> provides integrated support for accessing the ValueStack</li>
+<li> leverages XWork&#039;s support for internationalization, localization and error handling</li>
+<li> faster prototyping using templates (editable text files) instead of compiled code</li>
+<li> re-use and combine existing templates</li>
+</ul><br/>
+More on error message support:</p>In WebWork 2, there are two types of error messages: field error messages and action error messages. Field error messages are used to indicate a problem with a specific control and are displayed inline with the control. A number of tags provide built-in support for displaying these types of messages. Action error messages on the other hand, indicate a problem with executing an action. Many things can go wrong in a web application, especially an application that relies on external resources such as a database, remote web service, or other resource that might not be accessible during the execution of an action. Handling an error gracefully and presenting the user with a useful message can often be the difference in a positive user/customer experience and a bad one. <p class="paragraph">When these types of errors occur, it is more appropriate to display these messages separate from individual controls on the form. In the example below, we will create a custom component that can be used to display action error messages in a bulletted list. This component can then be used on all your forms to display these error messages.</p>The action class below was created to handle a promotion on the website: a free e-certificate. It will try to email the certificate, but an exception will be thrown.<p class="paragraph">Action class:</p><div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">package</span> example;&#10;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.ActionSupport;&#10;&#10;<span class="java&#45;keyword">public</span> class AddUser <span class="java&#45;keyword">extends</span> ActionSupport &#123;&#10;&#10;    <span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> fullname;&#10;    <span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> email;&#10;&#10;    <span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> execute() <span class="java&#45;keyword">throws</span> Exception &#123;&#10;        <span class="java&#45;comment">// we are ignoring field validation in <span class="java&#45;keyword">this</span> example</span>&#10;&#10;        <span class="java&#45;keyword">try</span> &#123;&#10;            MailUtil.sendCertificate(email, fullname);&#10;        &#125; <span class="java&#45;keyword">catch</span> (Exception ex) &#123;&#10;            <span class="java&#45;comment">// there was a problem sending the email</span>&#10;            <span class="java&#45;comment">// in a real application, we would also</span>&#10;            <span class="java&#45;comment">// log the exception</span>&#10;            addActionError(<span class="java&#45;quote">&quot;We are experiencing a technical problem and have contacted our support staff. &quot;</span> &#43;&#10;                           <span class="java&#45;quote">&quot;Please <span class="java&#45;keyword">try</span> again later.&quot;</span>);&#10;        &#125;&#10;&#10;        <span class="java&#45;keyword">if</span> (hasErrors()) &#123;&#10;            <span class="java&#45;keyword">return</span> ERROR;&#10;        &#125; <span class="java&#45;keyword">else</span> &#123;&#10;            <span class="java&#45;keyword">return</span> SUCCESS;&#10;        &#125;&#10;    &#125;&#10;&#10;    <span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getFullname() &#123;&#10;        <span class="java&#45;keyword">return</span> fullname;&#10;    &#125;&#10;&#10;    <span class="java&#45;keyword">public</span> void setFullname(<span class="java&#45;object">String</span> fullname) &#123;&#10;        <span class="java&#45;keyword">this</span>.fullname = fullname;&#10;    &#125;&#10;&#10;    <span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getEmail() &#123;&#10;        <span class="java&#45;keyword">return</span> email;&#10;    &#125;&#10;&#10;    <span class="java&#45;keyword">public</span> void setEmail(<span class="java&#45;object">String</span> email) &#123;&#10;        <span class="java&#45;keyword">this</span>.email = email;&#10;    &#125;&#10;&#10;&#125;</pre>
+</div></div><p class="paragraph">Jsp page:</p><div class="code"><div class="codeContent">
+<pre>&lt;&#37;&#64; taglib uri=<span class="java&#45;quote">&quot;webwork&quot;</span> prefix=<span class="java&#45;quote">&quot;ui&quot;</span> &#37;&gt;&#10;&#10;&lt;html&gt;&#10;&lt;head&gt;&lt;title&gt;custom component example&lt;/title&gt;&lt;/head&gt;&#10;&#10;&lt;&#33;&#45;&#45; don&#039;t forget <span class="java&#45;keyword">this</span> &#45;&#45;&gt;&#10;&lt;link rel =<span class="java&#45;quote">&quot;stylesheet&quot;</span> type=<span class="java&#45;quote">&quot;text/css&quot;</span> href=<span class="java&#45;quote">&quot;/webwork&#45;example/template/xhtml/styles.css&quot;</span> title=<span class="java&#45;quote">&quot;Style&quot;</span>&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;ui:form action=<span class="java&#45;quote">&quot;AddUser.action&quot;</span> method=<span class="java&#45;quote">&quot;POST&quot;</span>&gt;&#10;&lt;table&gt;&#10;    &lt;ui:component template=<span class="java&#45;quote">&quot;action&#45;errors.vm&quot;</span> /&gt;&#10;    &lt;ui:textfield label=<span class="java&#45;quote">&quot;Full Name&quot;</span> name=<span class="java&#45;quote">&quot;fullname&quot;</span> /&gt;&#10;    &lt;ui:textfield label=<span class="java&#45;quote">&quot;Email&quot;</span> name=<span class="java&#45;quote">&quot;email&quot;</span> /&gt;&#10;    &lt;ui:submit name=<span class="java&#45;quote">&quot;submit&quot;</span> value=<span class="java&#45;quote">&quot;Send me a free E&#45;Certificate&#33;&quot;</span> /&gt;&#10;&lt;/table&gt;&#10;&lt;/ui:form&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph">HTML output (before submitting):</p><div class="code"><div class="codeContent">
+<pre>&lt;html&gt;&#10;&lt;head&gt;&lt;title&gt;custom component example&lt;/title&gt;&lt;/head&gt;&#10;&lt;link rel =<span class="java&#45;quote">&quot;stylesheet&quot;</span> type=<span class="java&#45;quote">&quot;text/css&quot;</span> href=<span class="java&#45;quote">&quot;/webwork&#45;example/template/xhtml/styles.css&quot;</span> title=<span class="java&#45;quote">&quot;Style&quot;</span>&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;form  action=<span class="java&#45;quote">&quot;AddUser.action&quot;</span> method=<span class="java&#45;quote">&quot;POST&quot;</span> /&gt;&#10;&#10;&lt;table&gt;&#10;    &#10;&#10;    &lt;tr&gt;&#10;  &lt;td align=<span class="java&#45;quote">&quot;right&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt;&lt;span class=<span class="java&#45;quote">&quot;label&quot;</span>&gt;Full Name:&lt;/span&gt;&lt;/td&gt;&#10;  &lt;td&gt;&#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;fullname&quot;</span> value=<span class="java&#45;quote">&quot;&quot; /&gt;&#10;  &lt;/td&gt;&#10;&lt;/tr&gt;&#10;    &lt;tr&gt;&#10;  &lt;td align=&quot;</span>right<span class="java&#45;quote">&quot; valign=&quot;</span>top<span class="java&#45;quote">&quot;&gt;&lt;span class=&quot;</span>label<span class="java&#45;quote">&quot;&gt;Email:&lt;/span&gt;&lt;/td&gt;&#10;  &lt;td&gt;&#10;&lt;input type=&quot;</span>text<span class="java&#45;quote">&quot; name=&quot;</span>email<span class="java&#45;quote">&quot; value=&quot;</span><span class="java&#45;quote">&quot; /&gt;&#10;  &lt;/td&gt;&#10;&lt;/tr&gt;&#10;    &#10;&lt;tr&gt;&#10;  &lt;td colspan=&quot;</span>2<span class="java&#45;quote">&quot;&gt;&#10;    &lt;div align=&quot;</span>right<span class="java&#45;quote">&quot;&gt;&#10;      &lt;input type=&quot;</span>submit<span class="java&#45;quote">&quot; name=&quot;</span>submit<span class="java&#45;quote">&quot; value=&quot;</span>Send me a free E&#45;Certificate&#33;&quot;/&gt;&#10;    &lt;/div&gt;&#10;  &lt;/td&gt;&#10;&lt;/tr&gt;&#10;&#10;&#10;&lt;/table&gt;&#10;&lt;/form&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph">The template below will loop through any action errors and display them to the user in a bulletted list.</p>Template (action-errors.vm)<br/>
+
+<div class="code"><div class="codeContent">
+<pre>#set ($actionErrors = $stack.findValue(<span class="java&#45;quote">&quot;actionErrors&quot;</span>))&#10;&#10;#<span class="java&#45;keyword">if</span> ($actionErrors)&#10;&lt;tr&gt;&#10;    &lt;td colspan=<span class="java&#45;quote">&quot;2&quot;</span>&gt;&#10;        &lt;span class=<span class="java&#45;quote">&quot;errorMessage&quot;</span>&gt;The following errors occurred:&lt;/span&gt;&#10;        &lt;ul&gt;&#10;            #foreach ($actionError in $actionErrors)&#10;            &lt;li&gt;&lt;span class=<span class="java&#45;quote">&quot;errorMessage&quot;</span>&gt;$actionError&lt;/span&gt;&lt;/li&gt;&#10;            #end&#10;        &lt;/ul&gt;&#10;    &lt;/td&gt;&#10;&lt;/tr&gt;&#10;#end</pre>
+</div></div><p class="paragraph">HTML output (after submitting):</p><div class="code"><div class="codeContent">
+<pre>&lt;html&gt;&#10;&lt;head&gt;&lt;title&gt;custom component example&lt;/title&gt;&lt;/head&gt;&#10;&lt;link rel =<span class="java&#45;quote">&quot;stylesheet&quot;</span> type=<span class="java&#45;quote">&quot;text/css&quot;</span> href=<span class="java&#45;quote">&quot;/webwork&#45;example/template/xhtml/styles.css&quot;</span> title=<span class="java&#45;quote">&quot;Style&quot;</span>&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;form  action=<span class="java&#45;quote">&quot;AddUser.action&quot;</span> method=<span class="java&#45;quote">&quot;POST&quot;</span> /&gt;&#10;&#10;&lt;table&gt;&#10;    &#10;&lt;tr&gt;&#10;    &lt;td colspan=<span class="java&#45;quote">&quot;2&quot;</span>&gt;&#10;        &lt;span class=<span class="java&#45;quote">&quot;errorMessage&quot;</span>&gt;The following errors occurred:&lt;/span&gt;&#10;        &lt;ul&gt;&#10;            &lt;li class=<span class="java&#45;quote">&quot;errorMessage&quot;</span>&gt;&#10;                We are experiencing a technical problem and have contacted our &#10;                support staff. Please <span class="java&#45;keyword">try</span> again later.&#10;            &lt;/li&gt;&#10;        &lt;/ul&gt;&#10;    &lt;/td&gt;&#10;&lt;/tr&gt;&#10;&#10;    &lt;tr&gt;&#10;  &lt;td align=<span class="java&#45;quote">&quot;right&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt;&lt;span class=<span class="java&#45;quote">&quot;label&quot;</span>&gt;Full Name:&lt;/span&gt;&lt;/td&gt;&#10;  &lt;td&gt;&#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;fullname&quot;</span> value=<span class="java&#45;quote">&quot;Sample User&quot;</span> /&gt;&#10;  &lt;/td&gt;&#10;&lt;/tr&gt;&#10;    &lt;tr&gt;&#10;  &lt;td align=<span class="java&#45;quote">&quot;right&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt;&lt;span class=<span class="java&#45;quote">&quot;label&quot;</span>&gt;Email:&lt;/span&gt;&lt;/td&gt;&#10;  &lt;td&gt;&#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;email&quot;</span> value=<span class="java&#45;quote">&quot;user&#64;example.com&quot;</span> /&gt;&#10;  &lt;/td&gt;&#10;&lt;/tr&gt;&#10;    &#10;&lt;tr&gt;&#10;  &lt;td colspan=<span class="java&#45;quote">&quot;2&quot;</span>&gt;&#10;    &lt;div align=<span class="java&#45;quote">&quot;right&quot;</span>&gt;&#10;      &lt;input type=<span class="java&#45;quote">&quot;submit&quot;</span> name=<span class="java&#45;quote">&quot;submit&quot;</span> value=<span class="java&#45;quote">&quot;Send me a free E&#45;Certificate&#33;&quot;</span>/&gt;&#10;    &lt;/div&gt;&#10;  &lt;/td&gt;&#10;&lt;/tr&gt;&#10;&#10;&#10;&lt;/table&gt;&#10;&lt;/form&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><br/>
+
+
+
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/Themes.html

+<html>
+    <head>
+        <title>WebWork 2 : Themes</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : Themes
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 16, 2004 by <font color="#0050B2">casey</font>.
+				    </div>
+
+				    <p class="paragraph">A Theme is a set of <a href="templates.html" title="Templates">templates</a> used to customize web page development with UI tags.  They provide a powerful mechanism to help web developers spice up the UI with a mixture of styles (colors, fonts, etc).  For example, you may want half your form textfields to have a blue background and half a white background.   A couple of notes:</p><ul class="star">
+<li> Webwork comes with 2 pre-defined themes; <a href="#Themes-simple" title="simple on Themes">#simple</a> and <a href="#Themes-xhtml" title="xhtml on Themes">#xhtml</a> (default).  The default location webwork looks for themes in your web application is <tt class="monospaced">/template</tt>.  The default theme is <tt class="monospaced">xhtml</tt>.  Default, meaning that it will be used if you don&#039;t specify a theme attribute in your UI tag.  <ins class="inserted">Note:</ins> The default values can be overridden in your <a href="webwork.properties.html" title="webwork.properties">webwork.properties</a> file with <tt class="monospaced">webwork.ui.theme=</tt>  and <tt class="monospaced">webwork.ui.templateDir=</tt>.</li>
+</ul>
+<ul class="star">
+<li> <a href="#Themes-custom" title="custom on Themes">Custom themes</a> can also be created to tailor your own needs.  We recommend you consult the pre-defined templates as a starting point before you create your own.</li>
+</ul>
+<ul class="star">
+<li> Every time a UI tag is used, the tag is rendered into html by referencing a <a href="templates.html" title="Templates">template</a>.  So they play a key role in how fields look and are positioned in a page.  <ins class="inserted">Note:</ins> webwork uses only velocity templates (*.vm) to render both velocity and webwork tags, while ww1 defined templates in both jsp and vm.</li>
+</ul><br/>
+<ins class="inserted">Note:</ins> Before moving forward, it is recommended that you review how the webwork template system works.  (see <a href="Templates.html" title="Templates">Templates</a>)<p class="paragraph"><h3 class="heading3"><a name="Themes-xhtml%3Caname%3D%22Themesxhtml%22%3E%3C%2Fa%3E">  xhtml<a name="Themes-xhtml"></a></a></h3></p><tt class="monospaced">xhtml</tt> comes configured as the default theme for Webwork.  It extends the simple theme providing built in functionality for error reporting, table positioning, and labeling.  Lets look at one of the most common UI tags used, <tt class="monospaced">textfield</tt>, and show the proper way to write your views with the xhtml theme.<p class="paragraph">As you may already know, the default UI template used for the textfield tag is text.vm located under the directory /template/xhtml.</p><div class="code"><div class="codeContent">
+<pre>#&#42;&#10;   &#45;&#45; text.vm&#10;&#42;#&#10;## notice the re&#45;use of the simple theme template text.vm&#10;#parse(<span class="java&#45;quote">&quot;/template/xhtml/controlheader.vm&quot;</span>)&#10;#parse(<span class="java&#45;quote">&quot;/template/simple/text.vm&quot;</span>)&#10;#parse(<span class="java&#45;quote">&quot;/template/xhtml/controlfooter.vm&quot;</span>)</pre>
+</div></div><br/>
+When this template is loaded, it will first parse and render the /template/xhtml/controlheader.vm.  Within controlheader.vm you will notice functionlity for error reporting, labeling and table positioning.  If ActionSupport is returning with some errors, they are rendered into html using this this template.  Also you will notice how it grabs the parameter.label value and positions it with the textfield using the table elements tr and td.<br/>
+
+<div class="code"><div class="codeContent">
+<pre>#&#42;&#10;   &#45;&#45; controlheader.vm&#10;&#42;#&#10;## Only show message <span class="java&#45;keyword">if</span> errors are available.&#10;## This will be done <span class="java&#45;keyword">if</span> ActionSupport is used.&#10;&#10;#<span class="java&#45;keyword">if</span>( $fieldErrors.get($parameters.name) )&#10;  #set ($hasFieldErrors = $fieldErrors.get($parameters.name))&#10;  #foreach ($error in $fieldErrors.get($parameters.name))&#10;    &lt;tr&gt;&#10;        #<span class="java&#45;keyword">if</span> ($parameters.labelposition == &#039;top&#039;)&#10;            &lt;td align=<span class="java&#45;quote">&quot;left&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span> colspan=<span class="java&#45;quote">&quot;2&quot;</span>&gt;&#10;        #<span class="java&#45;keyword">else</span>&#10;            &lt;td align=<span class="java&#45;quote">&quot;center&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span> colspan=<span class="java&#45;quote">&quot;2&quot;</span>&gt;&#10;        #end&#10;            &lt;span class=<span class="java&#45;quote">&quot;errorMessage&quot;</span>&gt;$&#33;webwork.htmlEncode($error)&lt;/span&gt;&#10;            &lt;/td&gt;&#10;    &lt;/tr&gt;&#10;  #end&#10;#end&#10;&#10;## Provides alignment behavior with table tags&#10;## <span class="java&#45;keyword">if</span> the label position is top,&#10;## then give the label it&#039;s own row in the table&#10;## otherwise, display the label to the left on same row&#10;&#10;&lt;tr&gt;&#10;    #<span class="java&#45;keyword">if</span> ($parameters.labelposition == &#039;top&#039;)&#10;        &lt;td align=<span class="java&#45;quote">&quot;left&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span> colspan=<span class="java&#45;quote">&quot;2&quot;</span>&gt;&#10;    #<span class="java&#45;keyword">else</span>&#10;        &lt;td align=<span class="java&#45;quote">&quot;right&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt;&#10;    #end&#10;&#10;        #<span class="java&#45;keyword">if</span> ($hasFieldErrors)&#10;            &lt;span class=<span class="java&#45;quote">&quot;errorLabel&quot;</span>&gt;&#10;        #<span class="java&#45;keyword">else</span>&#10;            &lt;span class=<span class="java&#45;quote">&quot;label&quot;</span>&gt;&#10;        #end&#10;&#10;## If you want to mark required form fields with an asterisk, &#10;## you can set the required attribute&#10;## Ex. &lt;ui:textfield label=<span class="java&#45;quote">&quot;&#039;mylabel&#039;&quot;</span> name=<span class="java&#45;quote">&quot;&#039;myname&#039;&quot;</span> required=<span class="java&#45;quote">&quot;&#039;<span class="java&#45;keyword">true</span>&#039;&quot;</span> /&gt; &#10;        #<span class="java&#45;keyword">if</span> ($parameters.label)&#10;            #<span class="java&#45;keyword">if</span> ($parameters.required) &lt;span class=<span class="java&#45;quote">&quot;required&quot;</span>&gt;&#42;&lt;/span&gt; #end &#10;               $&#33;webwork.htmlEncode($parameters.label):&#10;        #end&#10;            &lt;/span&gt;&#10;        &lt;/td&gt;&#10;&#10;## add the extra row&#10;#<span class="java&#45;keyword">if</span> ($parameters.labelposition == &#039;top&#039;)&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;#end&#10;    &lt;td&gt;</pre>
+</div></div><br/>
+The next template being parsed in /template/xhtml/text.vm is /template/simple/text.vm.  Here you see the actual html input text tag being rendered and how the parameters are passed in.
+<div class="code"><div class="codeContent">
+<pre>#&#42;&#10;  &#45;&#45; text.vm&#10;  &#45;&#45;&#10;  &#45;&#45; Required Parameters:&#10;  &#45;&#45;   &#42; label      &#45; The description that will be used to identfy the control.&#10;  &#45;&#45;   &#42; name       &#45; The name of the attribute to put and pull the result from.&#10;  &#45;&#45;                  Equates to the NAME parameter of the HTML INPUT tag.&#10;  &#45;&#45;&#10;  &#45;&#45; Optional Parameters:&#10;  &#45;&#45;   &#42; labelposition   &#45; determines were the label will be place in relation&#10;  &#45;&#45;                       to the control.  Default is to the left of the control.&#10;  &#45;&#45;   &#42; size       &#45; SIZE parameter of the HTML INPUT tag.&#10;  &#45;&#45;   &#42; maxlength  &#45; MAXLENGTH parameter of the HTML INPUT tag.&#10;  &#45;&#45;   &#42; disabled   &#45; DISABLED parameter of the HTML INPUT tag.&#10;  &#45;&#45;   &#42; readonly   &#45; READONLY parameter of the HTML INPUT tag.&#10;  &#45;&#45;   &#42; onkeyup    &#45; onkeyup parameter of the HTML INPUT tag.&#10;  &#45;&#45;   &#42; tabindex  &#45; tabindex parameter of the HTML INPUT tag.&#10;  &#45;&#45;   &#42; onchange  &#45; onkeyup parameter of the HTML INPUT tag.&#10;  &#45;&#45;&#10;    &#42;#&#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span>&#10;                                   name=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.name)&quot;</span>&#10;#<span class="java&#45;keyword">if</span> ($parameters.size)             size=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.size)&quot;</span>            #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.maxlength)        maxlength=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.maxlength)&quot;</span>  #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.nameValue)        value=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.nameValue)&quot;</span>      #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.disabled == <span class="java&#45;keyword">true</span>) disabled=<span class="java&#45;quote">&quot;disabled&quot;</span>                                      #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.readonly)         readonly=<span class="java&#45;quote">&quot;readonly&quot;</span>                                      #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.onkeyup)          onkeyup=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.onkeyup)&quot;</span>      #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.tabindex)         tabindex=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.tabindex)&quot;</span>    #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.onchange)         onchange=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.onchange)&quot;</span>    #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.id)               id=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.id)&quot;</span>                #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.cssClass)         class=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.cssClass)&quot;</span>       #end&#10;#<span class="java&#45;keyword">if</span> ($parameters.cssStyle)         style=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.cssStyle)&quot;</span>       #end&#10;/&gt;</pre>
+</div></div>&#160;<br/>
+And finally, the controlfooter.vm is parsed to close up the td and tr tags that were previously opened in controlheader.vm
+<div class="code"><div class="codeContent">
+<pre>#&#42;&#10;   &#45;&#45; controlheader.vm&#10;&#42;#&#10;&#10;  &lt;/td&gt;&#10;&lt;/tr&gt;</pre>
+</div></div><p class="paragraph">In our view, since the tr and td elements are already created for us, we can simply wrap them with table elements.  For the sake of learning, we will just use normal html table objects, but feel free to look into how the table.vm tag gets rendered and possibly use that.
+<div class="code"><div class="codeContent">
+<pre>&lt;&#37;&#64; taglib uri=<span class="java&#45;quote">&quot;webwork&quot;</span> prefix=<span class="java&#45;quote">&quot;ui&quot;</span> &#37;&gt;&#10;&lt;link rel =<span class="java&#45;quote">&quot;stylesheet&quot;</span> type=<span class="java&#45;quote">&quot;text/css&quot;</span> href=<span class="java&#45;quote">&quot;template/xhtml/styles.css&quot;</span> title=<span class="java&#45;quote">&quot;Style&quot;</span>&gt;&#10;&lt;html&gt;&#10;&lt;head&gt;&lt;title&gt;JSP PAGE&lt;/title&gt;&lt;/head&gt;&#10;&lt;body&gt;&#10;&lt;form&gt;&#10;  &lt;table&gt;&#10;	&lt;&#33;&#45;&#45; we can set the required attribute to <span class="java&#45;keyword">true</span>&#160;<span class="java&#45;keyword">if</span> we want to &#10;	     display and asterisk next to required form fields&#10;	 &#45;&#45;&gt;&#10;&#10;	&lt;ui:textfield label=<span class="java&#45;quote">&quot;&#039;Username&#039;&quot;</span> required=<span class="java&#45;quote">&quot;&#039;<span class="java&#45;keyword">true</span>&#039;&quot;</span> name=<span class="java&#45;quote">&quot;&#039;user&#039;&quot;</span> /&gt; &#10;	&lt;ui:textfield label=<span class="java&#45;quote">&quot;&#039;Email&#039;&quot;</span> name=<span class="java&#45;quote">&quot;&#039;email&#039;&quot;</span>/&gt; &#10;  &lt;/table&gt;&#10;&lt;/form&gt;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div></p><div class="code"><div class="codeContent">
+<pre>&lt;link rel =<span class="java&#45;quote">&quot;stylesheet&quot;</span> type=<span class="java&#45;quote">&quot;text/css&quot;</span> href=<span class="java&#45;quote">&quot;template/xhtml/styles.css&quot;</span> title=<span class="java&#45;quote">&quot;Style&quot;</span>&gt;&#10;&lt;html&gt;&#10;&lt;head&gt;&lt;title&gt;VM PAGE&lt;/title&gt;&lt;/head&gt;&#10;&lt;body&gt;&#10;&lt;form&gt;&#10;  &lt;table&gt;&#10;    #tag( TextField <span class="java&#45;quote">&quot;label=&#039;Username&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;name=&#039;user&#039;&quot;</span> )&lt;br&gt;&#10;    #tag( TextField <span class="java&#45;quote">&quot;label=&#039;Email&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;name=&#039;email&#039;&quot;</span> )&lt;br&gt;&#10;  &lt;/table&gt;&#10;&lt;/form&gt;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="Themes-simple%3Caname%3D%22Themessimple%22%3E%3C%2Fa%3E">  simple<a name="Themes-simple"></a></a></h3></p>The <tt class="monospaced">simple</tt> theme provides no additional functionality from HTML tags (similiar to struts).  This theme is considered the low end of the structure and can be re-used (extended) like xhtml to add additional functionality or behavior.  You can easily create your own theme and extend this one to create complex pages that fit your own needs.<br/>
+To use the pre-defined theme <tt class="monospaced">simple</tt>
+<div class="preformatted"><div class="preformattedContent">
+<pre>&lt;&#37;&#64; taglib uri=&quot;webwork&quot; prefix=&quot;ui&quot; &#37;&gt;&#10;&lt;link rel =&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;template/xhtml/styles.css&quot; title=&quot;Style&quot;&gt;&#10;&lt;html&gt;&#10;&lt;head&gt;&lt;title&gt;JSP PAGE&lt;/title&gt;&lt;/head&gt;&#10;&lt;body&gt;&#10;  &lt;form&gt;&#10;	&lt;ui:label name=&quot;&#039;userlabel&#039;&quot; label=&quot;&#039;user&quot; theme=&quot;&#039;simple&#039;&quot;/&gt;&#10;                &lt;ui:textfield name=&quot;&#039;user&#039;&quot; theme=&quot;&#039;simple&#039;&quot;/&gt;&#10;&#10;	&lt;ui:label name=&quot;&#039;emaillabel&#039;&quot; label=&quot;&#039;user&quot; theme=&quot;&#039;simple&#039;&quot;/&gt;&#10;                &lt;ui:textfield name=&quot;&#039;email&#039;&quot; theme=&quot;&#039;simple&#039;&quot;/&gt;&#10;  &lt;/form&gt;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><br/>
+
+<div class="preformatted"><div class="preformattedContent">
+<pre>&lt;link rel =&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;template/xhtml/styles.css&quot; title=&quot;Style&quot;&gt;&#10;&lt;html&gt;&#10;&lt;head&gt;&lt;title&gt;VM PAGE&lt;/title&gt;&lt;/head&gt;&#10;&lt;body&gt;&#10;  &lt;form&gt;&#10;#tag( Label  &quot;name=&#039;userlabel&#039;&quot; &quot;label=&#039;user&#039;&quot; &quot;theme=&#039;simple&#039;&quot; )&#10;#tag( TextField  &quot;name=&#039;user&#039;&quot; &quot;theme=&#039;simple&#039;&quot; )&lt;br&gt;&#10;&#10;#tag( Label  &quot;name=&#039;emaillabel&#039;&quot; &quot;label=&#039;email&#039;&quot; &quot;theme=&#039;simple&#039;&quot; )&#10;#tag( TextField  &quot;name=&#039;email&#039;&quot; &quot;theme=&#039;simple&#039;&quot; )&lt;br&gt;&#10;  &lt;/form&gt;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="Themes-Creatingyourowntheme%3Caname%3D%22Themescustom%22%3E%3C%2Fa%3E">  Creating your own theme <a name="Themes-custom"></a></a></h3></p>Creating  themes is quite simple and can save valuable time enabling you to minimize UI code when it comes to creating complex UI pages.  It is recommended you understand webwork templates before you continue (see <a href="Templates.html" title="Templates">Templates</a>).  The steps required to use a theme.
+<ol>
+<li> Define a name for your theme by creating a subdirectory under /template directory.  The name of the subdirectory you create will be the same as the value you specify in your UI tag theme attribute.
+<div class="code"><div class="codeContent">
+<pre>/template/myTheme</pre>
+</div></div>
+<div class="code"><div class="codeContent">
+<pre>&lt;ui:textfield label=<span class="java&#45;quote">&quot;&#039;foo&#039;&quot;</span> name=<span class="java&#45;quote">&quot;&#039;bar&#039;&quot;</span> theme=<span class="java&#45;quote">&quot;&#039;myTheme&#039;&quot;</span> /&gt;</pre>
+</div></div>
+</li>
+<li> Create a velocity template for every UI tag that you want to use with your theme.  For example, if you have forms with only textfields and nothing else, then all you need in your subdirectory is a text.vm template.  Note: if you create a text.vm and reference another template with the parse tag, then you must make sure these templates are defined as well(ex. controlheader.vm).</li>
+<li> If you want your new theme to be the default so you don&#039;t have to specify the theme attribute every time in the UI tag, then modify the webwork.ui.theme value in your webwork.properties file.  Otherwise, you can just specify the theme attribute in all your UI tags.</li>
+</ol><p class="paragraph">As a good starting point, a good idea is to copy the contents of xhtml into a new subdirectory.  Therefore, you can modify the templates and still refer back to the originals as a reference point.</p>
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialEnd.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialEnd</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialEnd
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on May 13, 2004 by <font color="#0050B2">vitorsouza</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialEnd-EndofTutorial"> End of Tutorial</a></h1></p>This is the end of the WebWork Tutorial. If you followed the tutorial and understood the concepts that were explained and exemplified, you&#039;re ready to start developing your own WebWork application. If you want go deeper into WebWork&#039;s details, I suggest you read the Reference Guide at the <a href="Documentation.html" title="Documentation">Documentation Page</a>.<p class="paragraph"><hr class="line"/><br/>
+<a href="TutorialLesson05.html" title="TutorialLesson05">Previous Lesson</a></p><br clear="all" />
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialExamples.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialExamples</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialExamples
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 09, 2004 by <font color="#0050B2">vitorsouza</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialExamples-WebWorkTutorial%26%23039%3BsExamples"> WebWork Tutorial&#039;s Examples</a></h1></p>The examples supplied in this tutorial are available as a Web Application for you to deploy and run. Download <tt class="monospaced">wwtutorialexamples.war</tt> below and install it in your Servlet Container. You can also extract the files from the archive using your favorite Zip software.<p class="paragraph"><a href="" title="wwtutorialexamples.war attached to TutorialExamples">wwtutorialexamples.war</a></p>
+
+				    					    <br/>
+                        <div class="tabletitle">
+                            <a name="attachments">Attachments:</a>
+                        </div>
+
+                        <div class="greybox" align="left">
+                                                            <img src="icons/bullet_blue.gif" height="8" width="8" alt=""/>
+                                <a href="TutorialExamples_attachments/wwtutorialexamples.war">wwtutorialexamples.war</a> (application/x-zip-compressed)
+                                <br/>
+                                                    </div>
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialLesson01.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialLesson01</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialLesson01
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 14, 2004 by <font color="#0050B2">vitorsouza</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialLesson01-Lesson1%3ADownloadingandInstallingWebWork"> Lesson 1: Downloading and Installing WebWork</a></h1></p>The first step to use WebWork is installing it. The current version can be found at <a href="https://webwork.dev.java.net/servlets/ProjectDocumentList" title="Visit page outside Confluence">webwork.dev.java.net</a>. This tutorial is based on version 2.1, which was the latest version at the time it was written.<p class="paragraph">After downloading <em class="emphasis"><tt class="monospaced">webwork-2.1.zip</tt></em>, unpack it anywhere you like. The libraries that are needed to use WebWork are <tt class="monospaced">webwork-2.1.jar</tt> and all the JAR files inside the <tt class="monospaced">lib/core</tt> folder.</p>The next lesson will use these libraries to set up the web application.<p class="paragraph"><hr class="line"/></p><a href="TutorialLesson02.html" title="TutorialLesson02">Next Lesson</a>
+
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialLesson02.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialLesson02</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialLesson02
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 14, 2004 by <font color="#0050B2">vitorsouza</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialLesson02-Lesson2%3ASettinguptheWebApplication"> Lesson 2: Setting up the Web Application</a></h1></p>It is assumed that you have a Servlet container set up and you know how to create a web application. If you don&#039;t, we suggest you learn about  <a href="http://jakarta.apache.org/tomcat/" title="Visit page outside Confluence">Apache Tomcat</a>, which is a free Servlet container from the Apache Jakarta Project, or Resin, from <a href="http://www.caucho.com/" title="Visit page outside Confluence">Caucho Technology</a>, which is free for non-comercial use.<p class="paragraph">To use WebWork, copy the required libraries, described in the previous lesson (<tt class="monospaced">webwork-2.1.jar</tt> and <tt class="monospaced">lib/core/&#42;.jar</tt>), to the directory <tt class="monospaced">WEB-INF/lib</tt> of the Web Application. Then, configure <tt class="monospaced">web.xml</tt> and create other two XML files: <tt class="monospaced">xwork.xml</tt> and <tt class="monospaced">validators.xml</tt>. These three files will be explained below.</p><h3 class="heading3"><a name="TutorialLesson02-web.xml%3A"> web.xml:</a></h3><p class="paragraph">Change your web application&#039;s web.xml file to look somewhat like this:</p><div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#63;xml version=<span class="xml&#45;quote">&quot;1.0&quot;</span>&#63;&gt;</span>&#10;<span class="xml&#45;tag">&lt;&#33;DOCTYPE web&#45;app PUBLIC <span class="xml&#45;quote">&quot;&#45;//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;</span>&#10;<span class="xml&#45;quote">&quot;&#104;ttp://java.sun.com/dtd/web&#45;app&#95;2&#95;3.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;web&#45;app&gt;</span>&#10;	<span class="xml&#45;tag">&lt;display&#45;name&gt;</span>My WebWork Application<span class="xml&#45;tag">&lt;/display&#45;name&gt;</span>&#10;	<span class="xml&#45;tag">&lt;servlet&gt;</span>&#10;		<span class="xml&#45;tag">&lt;servlet&#45;name&gt;</span>webwork<span class="xml&#45;tag">&lt;/servlet&#45;name&gt;</span>&#10;		<span class="xml&#45;tag">&lt;servlet&#45;class&gt;</span>com.opensymphony.webwork.dispatcher.ServletDispatcher<span class="xml&#45;tag">&lt;/servlet&#45;class&gt;</span>&#10;		<span class="xml&#45;tag">&lt;load&#45;on&#45;startup&gt;</span>1<span class="xml&#45;tag">&lt;/load&#45;on&#45;startup&gt;</span>&#10;	<span class="xml&#45;tag">&lt;/servlet&gt;</span>&#10;	<span class="xml&#45;tag">&lt;servlet&#45;mapping&gt;</span>&#10;		<span class="xml&#45;tag">&lt;servlet&#45;name&gt;</span>webwork<span class="xml&#45;tag">&lt;/servlet&#45;name&gt;</span>&#10;		<span class="xml&#45;tag">&lt;url&#45;pattern&gt;</span>&#42;.action<span class="xml&#45;tag">&lt;/url&#45;pattern&gt;</span>&#10;	<span class="xml&#45;tag">&lt;/servlet&#45;mapping&gt;</span>&#10;	<span class="xml&#45;tag">&lt;taglib&gt;</span>&#10;		<span class="xml&#45;tag">&lt;taglib&#45;uri&gt;</span>webwork<span class="xml&#45;tag">&lt;/taglib&#45;uri&gt;</span>&#10;		<span class="xml&#45;tag">&lt;taglib&#45;location&gt;</span>/WEB&#45;INF/lib/webwork&#45;2.1.jar<span class="xml&#45;tag">&lt;/taglib&#45;location&gt;</span>&#10;	<span class="xml&#45;tag">&lt;/taglib&gt;</span>&#10;<span class="xml&#45;tag">&lt;/web&#45;app&gt;</span></pre>
+</div></div><p class="paragraph">To use WebWork you must register <tt class="monospaced">ServletDispatcher</tt> and its mapping to <tt class="monospaced">&#42;.action</tt>. It will be explained why those lines are important in the section about Actions in the <a href="TutorialLesson03.html" title="TutorialLesson03">next lesson</a>. In the example above WebWork&#039;s taglib descriptor is also declared to allow the usage of WebWork tags (more about WebWork tags on <a href="TutorialLesson04-01.html" title="TutorialLesson04-01">lesson 4.1</a>) &#8211; it is safe to remove it if WebWork tags are not being used.</p><blockquote class="blockquote"> Read more: <a href="web.xml.html" title="web.xml">web.xml</a></blockquote>
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson02-xwork.xml%3A"> xwork.xml:</a></h3></p>At the root of the classpath (namely, <tt class="monospaced">WEB-INF/classes</tt>) create a file called <tt class="monospaced">xwork.xml</tt>, which WebWork uses to configure itself. For now, place the following content in it:<br/>
+
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span> &#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Include webwork defaults (from WebWork&#45;2.1 JAR). &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;include file=<span class="xml&#45;quote">&quot;webwork&#45;default.xml&quot;</span> /&gt;</span>&#10;	&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Configuration for the default package. &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;default&quot;</span> extends=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div><p class="paragraph">This is just a skeleton of a configuration file, which will be incremented as we go through the lessons. As of now, it is only doing two things:</p><ul class="star">
+<li> informing WebWork that it should import the configuration information from <tt class="monospaced">webwork-default.xml</tt> (which is located at the root of <tt class="monospaced">webwork-2.1.jar</tt> and thus available for use) &#8211; this file defines the <tt class="monospaced">webwork-default</tt> package, which contains the <em class="emphasis">default</em> configuration for WebWork applications;</li>
+</ul>
+<ul class="star">
+<li> defining a <tt class="monospaced">default</tt> package, which is where the actions, results and interceptors are registered. This package extends <tt class="monospaced">webwork-default</tt>, i.e., the <tt class="monospaced">default</tt> package will inherit all the configuration defined in <tt class="monospaced">webwork-default</tt>.</li>
+</ul><br/>
+<blockquote class="blockquote"> Read more: <a href="xwork.xml.html" title="xwork.xml">xwork.xml</a></blockquote>
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson02-validators.xml%3A"> validators.xml:</a></h3></p>Again, at the root of the classpath, create a file called <tt class="monospaced">validators.xml</tt>, with the following content:<br/>
+
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE validators PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork Validator&#10;1.0//EN&quot;</span>&#160;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;validator&#45;1.0.dtd&quot;</span>&gt;</span> &#10;&#10;<span class="xml&#45;tag">&lt;validators&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;required&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.RequiredFieldValidator&quot;</span>/&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.RequiredStringValidator&quot;</span>/&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;int&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.IntRangeFieldValidator&quot;</span>/&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;date&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.DateRangeFieldValidator&quot;</span>/&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;expression&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.ExpressionValidator&quot;</span>/&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;fieldexpression&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.FieldExpressionValidator&quot;</span>/&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;email&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.EmailValidator&quot;</span>/&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;url&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.URLValidator&quot;</span>/&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;visitor&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.VisitorFieldValidator&quot;</span>/&gt;</span> &#10;	<span class="xml&#45;tag">&lt;validator name=<span class="xml&#45;quote">&quot;conversion&quot;</span>&#10;		class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.validators.ConversionErrorFieldValidator&quot;</span>/&gt;</span> &#10;<span class="xml&#45;tag">&lt;/validators&gt;</span></pre>
+</div></div><p class="paragraph">This file defines the validators that are available for use.</p><blockquote class="blockquote"> Read more: <a href="Validation.html" title="Validation">Validation</a></blockquote>
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson02-AllSetUp%21"> All Set Up!</a></h2></p>Now there is a skeleton of the WebWork application already set up. Next lessons will teach how to use WebWork&#039;s actions, views and interceptors.<p class="paragraph"><hr class="line"/></p><a href="TutorialLesson01.html" title="TutorialLesson01">Previous Lesson</a> | <a href="TutorialLesson03.html" title="TutorialLesson03">Next Lesson</a><br/>
+
+
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialLesson03.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialLesson03</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialLesson03
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 14, 2004 by <font color="#0050B2">vitorsouza</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialLesson03-Lesson3%3AActionsandResults"> Lesson 3: Actions and Results</a></h1></p>Actions are the basic unit of execution. An action is a class that is registered under WebWork&#039;s configuration to respond to a specific request. In a Model-View-Controller approach, the Action is part of the Controller, leaving to JSP pages what they do best: being the View.<p class="paragraph">The following steps are a possible way of creating an action in WebWork:</p><ol>
+<li> Create a JSP page that will call the action;</li>
+<li> Create the action class;</li>
+<li> Create a JSP page that will process the result;</li>
+<li> Register the action in <tt class="monospaced">xwork.xml</tt>.</li>
+</ol><br/>
+The first example of this tutorial could be no other than <em class="emphasis">&quot;Hello, WebWorld!&quot;</em>. The code below displays WebWork&#039;s configuration file <tt class="monospaced">xwork.xml</tt> with configuration for an action under the <tt class="monospaced">default</tt> package.
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson03-xwork.xml%3A"> xwork.xml:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span>&#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Include webwork defaults (from WebWork&#45;2.1 JAR). &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;include file=<span class="xml&#45;quote">&quot;webwork&#45;default.xml&quot;</span> /&gt;</span>&#10;	&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Configuration for the default package. &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;default&quot;</span> extends=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Default interceptor stack. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;default&#45;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;defaultStack&quot;</span> /&gt;</span> &#10;		&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Action: Lesson 03: HelloWebWorldAction. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;helloWebWorld&quot;</span> class=<span class="xml&#45;quote">&quot;lesson03.HelloWebWorldAction&quot;</span>&gt;</span> &#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>ex01&#45;success.jsp<span class="xml&#45;tag">&lt;/result&gt;</span> &#10;		<span class="xml&#45;tag">&lt;/action&gt;</span> &#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div></p>Don&#039;t worry about the <tt class="monospaced">default-interceptor-ref</tt> yet. For now we are interested in the action only. This configuration file is telling WebWork that there is an action called <tt class="monospaced">helloWebWorld</tt> which is implemented by the class <tt class="monospaced">lesson03.HelloWebWorldAction</tt>. For this action, we define a result under the name <tt class="monospaced">success</tt> which points to the web page <tt class="monospaced">ex01-success.jsp</tt>.<br/>
+
+<blockquote class="blockquote"> Read more: <a href="xwork.xml.html" title="xwork.xml">xwork.xml</a></blockquote><p class="paragraph">Things should get clearer once we take a look at the code that calls the action:</p><h3 class="heading3"><a name="TutorialLesson03-ex01index.jsp%3A"> ex01-index.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 3 &#45; Example 1&lt;/title&gt;&#10;&lt;/head&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;p&gt;Click the button below to activate HelloWebWorldAction.&lt;/p&gt;&#10;&#10;&lt;form action=<span class="java&#45;quote">&quot;helloWebWorld.action&quot;</span> method=<span class="java&#45;quote">&quot;post&quot;</span>&gt;&#10;&lt;p&gt;&lt;input type=<span class="java&#45;quote">&quot;submit&quot;</span> value=<span class="java&#45;quote">&quot;Hello&#33;&quot;</span> /&gt;&lt;/p&gt;&#10;&lt;/form&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph">This is how web pages can integrate with WebWork: by accessing <tt class="monospaced">&#42;.action</tt> URLs. Recalling the previous lesson, that&#039;s why we registered WebWork&#039;s <tt class="monospaced">ServletDispatcher</tt> with mapping to <tt class="monospaced">&#42;.action</tt>.</p>When we click the button in our example page, the browser will send the form data to the URL <tt class="monospaced">helloWebWorld.action</tt>. Since this URL fits under the mapping <tt class="monospaced">&#42;.action</tt>, the Servlet container will activate WebWork&#039;s <tt class="monospaced">ServletDispatcher</tt>, which will read <tt class="monospaced">xwork.xml</tt> and look for an action called <tt class="monospaced">helloWebWorld</tt>. If the action is found, a <b class="strong">new</b> instance of the action class is created and the method <tt class="monospaced">execute()</tt> is called.<p class="paragraph">Let&#039;s see the action class, then:</p><h3 class="heading3"><a name="TutorialLesson03-HelloWebWorldAction.java%3A"> HelloWebWorldAction.java:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">package</span> lesson03; &#10;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.ActionSupport; &#10;&#10;<span class="java&#45;keyword">public</span> class HelloWebWorldAction <span class="java&#45;keyword">extends</span> ActionSupport &#123; &#10;	<span class="java&#45;object">String</span> hello; &#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getHello() &#123; &#10;		<span class="java&#45;keyword">return</span> hello; &#10;	&#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> execute() <span class="java&#45;keyword">throws</span> Exception &#123; &#10;		hello = <span class="java&#45;quote">&quot;Hello, WebWorld&#33;&quot;</span>; &#10;		<span class="java&#45;keyword">return</span> SUCCESS; &#10;	&#125; &#10;&#125;</pre>
+</div></div><p class="paragraph">First, notice that this class extends <tt class="monospaced">com.opensymphony.xwork.ActionSupport</tt> and implements the method <tt class="monospaced">public String execute()</tt>. For starters, all your action classes should do that. Second, notice that the method <tt class="monospaced">execute()</tt> only sets the value of the <tt class="monospaced">hello</tt> property and returns the constant <tt class="monospaced">SUCCESS</tt>, which is a String whose value is <tt class="monospaced">&quot;success&quot;</tt>.</p>When the ServletDispatcher gets <tt class="monospaced">&quot;success&quot;</tt> as return from <tt class="monospaced">execute()</tt>, it looks again at <tt class="monospaced">xwork.xml</tt> for a result with that name, finds it, and moves on to <tt class="monospaced">ex01-success.jsp</tt>, as specified in the configuration. <p class="paragraph">Let&#039;s see what that page does:</p><h3 class="heading3"><a name="TutorialLesson03-ex01success.jsp%3A"> ex01-success.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;&#37;&#64; taglib uri=<span class="java&#45;quote">&quot;webwork&quot;</span> prefix=<span class="java&#45;quote">&quot;ww&quot;</span> &#37;&gt; &#10;&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 3 &#45; Example 1&lt;/title&gt; &#10;&lt;/head&gt; &#10;&lt;body&gt; &#10;&#10;&lt;ww:property value=<span class="java&#45;quote">&quot;hello&quot;</span> /&gt; &#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph">If you run the example, you will see that this page will display <tt class="monospaced">&quot;Hello, WebWorld!&quot;</tt>. That happens because what the <tt class="monospaced">&lt;ww:property value=&quot;hello&quot; /&gt;</tt> tag does is look for the property <tt class="monospaced">hello</tt> in the action class that just executed. Actually, it looks for an accessor method, so it ends up calling <tt class="monospaced">getHello()</tt>. Since <tt class="monospaced">HelloWebWorldAction</tt> was called and set the value of the hello property to <tt class="monospaced">&quot;Hello, WebWorld!&quot;</tt>, <tt class="monospaced">getHello()</tt> will return that value and it will be displayed by the resulting JSP page.</p><blockquote class="blockquote"> <a href="TutorialExamples.html" title="TutorialExamples">Try the example!</a></blockquote>
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson03-SupplyingDatatotheAction"> Supplying Data to the Action</a></h2></p>The previous example demonstrated how WebWork&#039;s actions work, but we can&#039;t do much if we&#039;re not able to supply data to our action. Let&#039;s see an example that does just that:
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson03-xwork.xml%3A"> xwork.xml:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span>&#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Include webwork defaults (from WebWork&#45;2.1 JAR). &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;include file=<span class="xml&#45;quote">&quot;webwork&#45;default.xml&quot;</span> /&gt;</span>&#10;	&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Configuration for the default package. &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;default&quot;</span> extends=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Default interceptor stack. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;default&#45;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;defaultStack&quot;</span> /&gt;</span> &#10;		&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Action: Lesson 03: HelloAction. &#45;&#45;&gt;</span></span>&#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;hello&quot;</span> class=<span class="xml&#45;quote">&quot;lesson03.HelloAction&quot;</span>&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;error&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>ex02&#45;index.jsp<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>ex02&#45;success.jsp<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/action&gt;</span>&#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson03-HelloAction.java%3A"> HelloAction.java:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">package</span> lesson03;&#10;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.ActionSupport;&#10;&#10;<span class="java&#45;keyword">public</span> class HelloAction <span class="java&#45;keyword">extends</span> ActionSupport &#123;&#10;	<span class="java&#45;object">String</span> person;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getPerson() &#123;&#10;		<span class="java&#45;keyword">return</span> person;&#10;	&#125;&#10;	<span class="java&#45;keyword">public</span> void setPerson(<span class="java&#45;object">String</span> person) &#123;&#10;		<span class="java&#45;keyword">this</span>.person = person;&#10;	&#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> execute() <span class="java&#45;keyword">throws</span> Exception &#123;&#10;		<span class="java&#45;keyword">if</span> ((person == <span class="java&#45;keyword">null</span>) || (person.length() == 0)) <span class="java&#45;keyword">return</span> ERROR;&#10;		<span class="java&#45;keyword">else</span>&#160;<span class="java&#45;keyword">return</span> SUCCESS;&#10;	&#125;&#10;&#125;</pre>
+</div></div>
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson03-ex02index.jsp%3A"> ex02-index.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 3 &#45; Example 2&lt;/title&gt;&#10;&lt;/head&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;p&gt;What&#039;s your name&#63;&lt;/p&gt;&#10;&#10;&lt;form action=<span class="java&#45;quote">&quot;hello.action&quot;</span> method=<span class="java&#45;quote">&quot;post&quot;</span>&gt;&#10;&lt;p&gt;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;person&quot;</span> /&gt;&lt;input type=<span class="java&#45;quote">&quot;submit&quot;</span> /&gt;&lt;/p&gt;&#10;&lt;/form&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson03-ex02success.jsp%3A"> ex02-success.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;&#37;&#64; taglib uri=<span class="java&#45;quote">&quot;webwork&quot;</span> prefix=<span class="java&#45;quote">&quot;ww&quot;</span> &#37;&gt;&#10;&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 3 &#45; Example 2&lt;/title&gt;&#10;&lt;/head&gt;&#10;&lt;body&gt;&#10;&#10;Hello, &lt;ww:property value=<span class="java&#45;quote">&quot;person&quot;</span> /&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph">Let&#039;s analyse the differences: in this example we are sending form data via POST, under the name of <tt class="monospaced">person</tt>. Because of that, after a new instance of <tt class="monospaced">HelloAction</tt> is created, WebWork&#039;s <tt class="monospaced">ServletDispatcher</tt> will try to fill the action&#039;s property <tt class="monospaced">person</tt> with the data that was sent, therefore calling the mutator method <tt class="monospaced">setPerson()</tt> (actually, that is done by the <tt class="monospaced">ParametersInterceptor</tt>, which we will only learn about later, in <a href="TutorialLesson05.html" title="TutorialLesson05">lesson 5</a> &#8211; for now, know that when the action is executed, the property is already set).</p>If you look at the action class&#039; code, you will see that during <tt class="monospaced">execute()</tt>, it checks if the property was filled (i.e. if data was supplied in the form field). If it was, it returns <tt class="monospaced">SUCCESS</tt>, therefore dispatching the request to <tt class="monospaced">ex02-success.jsp</tt>, otherwise, it returns <tt class="monospaced">ERROR</tt>, moving back to <tt class="monospaced">ex02-index.jsp</tt>.<br/>
+
+<blockquote class="blockquote"> <a href="TutorialExamples.html" title="TutorialExamples">Try the example!</a></blockquote>
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson03-TypesofResult"> Types of Result</a></h2></p>On the examples above, when we say that a result is of type <tt class="monospaced">&quot;dispatcher&quot;</tt> it means that WebWork looks for a <tt class="monospaced">result-type</tt> called <tt class="monospaced">dispatcher</tt> and finds out which result class implements it. An instance of that class is activated whenever the action returns that type of result.<p class="paragraph">Result classes are implement the <tt class="monospaced">com.opensymphony.xwork.Result</tt> interface. WebWork comes with some result classes already implemented, but you can build your own, if you want. WebWork&#039;s result types are already configured in <tt class="monospaced">webwork-default.xml</tt>:</p><ul class="star">
+<li> <b class="strong">dispatcher</b> (<tt class="monospaced">com.opensymphony.webwork.dispatcher.ServletDispatcherResult</tt>): forwards the result to the specified location;</li>
+</ul>
+<ul class="star">
+<li> <b class="strong">redirect</b> (<tt class="monospaced">com.opensymphony.webwork.dispatcher.ServletRedirectResult</tt>): redirects the result to the specified location. Unlike the dispatcher, the redirection does not send form data (via POST or GET) to the specified page;</li>
+</ul>
+<ul class="star">
+<li> <b class="strong">velocity</b> (<tt class="monospaced">com.opensymphony.webwork.dispatcher.VelocityResult</tt>): uses a Velocity template as the result. You could use the dispatcher to forward results to Velocity pages if you have <tt class="monospaced">VelocityServlet</tt> configured in <tt class="monospaced">web.xml</tt>, but using the Velocity result is a better approach. More on Velocity on <a href="TutorialLesson04-02.html" title="TutorialLesson04-02">lesson 4.2</a>;</li>
+</ul>
+<ul class="star">
+<li> <b class="strong">chain</b> (<tt class="monospaced">com.opensymphony.xwork.ActionChainResult</tt>): chains an action on another, i.e., the result of an action is another action;</li>
+</ul>
+<ul class="star">
+<li> <b class="strong">xslt</b> (<tt class="monospaced">com.opensymphony.webwork.views.xslt.XSLTResult</tt>): uses an XML document transformed by an XSLT style sheet as the result.</li>
+</ul><br/>
+<blockquote class="blockquote"> Read more: <a href="Result Types.html" title="Result Types">Result Types</a></blockquote>
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson03-Movingon"> Moving on</a></h2></p>These examples illustrate the main concept of actions and results: they are units of execution that respond to requests, do some processing and, depending on the result, dispatch the request to some other location. Although that might seem very simple, it&#039;s just the core of WebWork&#039;s functionality. <p class="paragraph">Here are some other things that can be done with actions, just so you know what WebWork can do before we move on to other lessons:</p><ul class="star">
+<li> With interceptors, it can log every action execution an even clock the execution time (<a href="TutorialLesson05.html" title="TutorialLesson05">lesson 5</a>);</li>
+</ul>
+<ul class="star">
+<li> The action could work directly with your business object by implementing the ModelDriven interface;</li>
+</ul>
+<ul class="star">
+<li> With XML files, configure the validation of the data that is sent to the action. If some data is not valid according to your specification, the action is not executed and error messages are attached to the action (reference: <a href="Validation.html" title="Validation">Validation</a>);</li>
+</ul>
+<ul class="star">
+<li> By using WebWork UI Tags in association with the validation framework, forms will automatically display error messages due to invalid data input (<a href="TutorialLesson04-01-01.html" title="TutorialLesson04-01-01">lesson 4.1.1</a>);</li>
+</ul>
+<ul class="star">
+<li> WebWork can provide to some actions instances of components (in different scopes) automatically, allowing Inversion of Control (reference: <span class="error">&#91;Inversion of Control &amp; Components&#93;</span>);</li>
+</ul><br/>
+The next lessons will talk about the different types of views that can be used by WebWork.<p class="paragraph"><hr class="line"/></p><a href="TutorialLesson02.html" title="TutorialLesson02">Previous Lesson</a> | <a href="TutorialLesson04.html" title="TutorialLesson04">Next Lesson</a><br/>
+
+
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialLesson04-01-01.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialLesson04-01-01</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialLesson04-01-01
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 14, 2004 by <font color="#0050B2">vitorsouza</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialLesson04-01-01-Lesson4.1.1%3AWebWorkUITags"> Lesson 4.1.1: WebWork UI Tags</a></h1></p>In WebWork, the UI tags wrap generic HTML controls while providing tight integration with the core framework. The tags have been designed to minimize the amount of logic in compiled code and delegate the actual rendering of HTML to a template system. The UI tags attempt to cover the most common scenarios, while providing a Component Tag for creating custom components. The UI tags also provide built-in support for displaying inline error messages.<p class="paragraph">This lesson tries to explain how to take advantage of the UI tags to build forms and other graphical controls and, by explaining how the template system works, teaches you how to change the look of existing components and create your own UI components.</p><h2 class="heading2"><a name="TutorialLesson04-01-01-Buildingforms%3A"> Building forms:</a></h2><p class="paragraph">WebWork comes with ready-to-use tags to construct forms. Some of these tags relate directly to HTML tags that are used to make forms and you probably can figure them out by their names: <tt class="monospaced">&lt;ww:checkbox /&gt;</tt>, <tt class="monospaced">&lt;ww:file /&gt;</tt>, <tt class="monospaced">&lt;ww:form /&gt;</tt>, <tt class="monospaced">&lt;ww:hidden /&gt;</tt>, <tt class="monospaced">&lt;ww:label /&gt;</tt>, <tt class="monospaced">&lt;ww:password /&gt;</tt>, <tt class="monospaced">&lt;ww:radio /&gt;</tt>, <tt class="monospaced">&lt;ww:select /&gt;</tt>, <tt class="monospaced">&lt;ww:submit /&gt;</tt>, <tt class="monospaced">&lt;ww:textarea /&gt;</tt> and <tt class="monospaced">&lt;ww:textfield /&gt;</tt>.</p>To build forms with these tags, place them in your page as you would do with the HTML tags. The only difference is that the parameters should be enclosed in double quotes and single quotes (<tt class="monospaced">key=&quot;&#039;value&#039;&quot;</tt>). That&#039;s because names that are not single-quoted are evaluated against the Value Stack.<p class="paragraph">Let&#039;s check out an example:</p><h3 class="heading3"><a name="TutorialLesson04-01-01-ex01index.jsp%3A"> ex01-index.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;&#37;&#64; taglib uri=<span class="java&#45;quote">&quot;webwork&quot;</span> prefix=<span class="java&#45;quote">&quot;ww&quot;</span> &#37;&gt;&#10;&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.1.1 &#45; Example 1&lt;/title&gt;&#10;&lt;meta http&#45;equiv=<span class="java&#45;quote">&quot;Content&#45;Type&quot;</span> content=<span class="java&#45;quote">&quot;text/html; charset=iso&#45;8859&#45;1&quot;</span>&gt;&#10;&lt;style type=<span class="java&#45;quote">&quot;text/css&quot;</span>&gt;&#10;	.errorMessage &#123; color: red; &#125;&#10;&lt;/style&gt;&#10;&lt;/head&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;p&gt;UI Form Tags Example:&lt;/p&gt;&#10;&#10;&lt;ww:form action=<span class="java&#45;quote">&quot;&#039;formProcessing.action&#039;&quot;</span> method=<span class="java&#45;quote">&quot;&#039;post&#039;&quot;</span>&gt;&#10;	&lt;ww:checkbox name=<span class="java&#45;quote">&quot;&#039;checkbox&#039;&quot;</span> label=<span class="java&#45;quote">&quot;&#039;A checkbox&#039;&quot;</span> fieldValue=<span class="java&#45;quote">&quot;&#039;checkbox&#95;value&#039;&quot;</span> /&gt;&#10;	&lt;ww:file name=<span class="java&#45;quote">&quot;&#039;file&#039;&quot;</span> label=<span class="java&#45;quote">&quot;&#039;A file field&#039;&quot;</span> /&gt;&#10;	&lt;ww:hidden name=<span class="java&#45;quote">&quot;&#039;hidden&#039;&quot;</span> value=<span class="java&#45;quote">&quot;&#039;hidden&#95;value&#039;&quot;</span> /&gt;&#10;	&lt;ww:label label=<span class="java&#45;quote">&quot;&#039;A label&#039;&quot;</span> /&gt;&#10;	&lt;ww:password name=<span class="java&#45;quote">&quot;&#039;password&#039;&quot;</span> label=<span class="java&#45;quote">&quot;&#039;A password field&#039;&quot;</span> /&gt;&#10;	&lt;ww:radio name=<span class="java&#45;quote">&quot;&#039;radio&#039;&quot;</span> label=<span class="java&#45;quote">&quot;&#039;Radio buttons&#039;&quot;</span> list=<span class="java&#45;quote">&quot;&#123;&#039;One&#039;, &#039;Two&#039;, &#039;Three&#039;&#125;&quot;</span> /&gt;&#10;	&lt;ww:select name=<span class="java&#45;quote">&quot;&#039;select&#039;&quot;</span> label=<span class="java&#45;quote">&quot;&#039;A select list&#039;&quot;</span> list=<span class="java&#45;quote">&quot;&#123;&#039;One&#039;, &#039;Two&#039;, &#039;Three&#039;&#125;&quot;</span> &#10;		emptyOption=<span class="java&#45;quote">&quot;<span class="java&#45;keyword">true</span>&quot;</span> /&gt;&#10;	&lt;ww:textarea name=<span class="java&#45;quote">&quot;&#039;textarea&#039;&quot;</span> label=<span class="java&#45;quote">&quot;&#039;A text area&#039;&quot;</span> rows=<span class="java&#45;quote">&quot;&#039;3&#039;&quot;</span> cols=<span class="java&#45;quote">&quot;&#039;40&#039;&quot;</span> /&gt;&#10;	&lt;ww:textfield name=<span class="java&#45;quote">&quot;&#039;textfield&#039;&quot;</span> label=<span class="java&#45;quote">&quot;&#039;A text field&#039;&quot;</span> /&gt;&#10;	&lt;ww:submit value=<span class="java&#45;quote">&quot;&#039;Send Form&#039;&quot;</span> /&gt;&#10;&lt;/ww:form&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-01-HTMLresultafterprocessingex01index.jsp%3A"> HTML result after processing ex01-index.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.1.1 &#45; Example 1&lt;/title&gt;&#10;&lt;style type=<span class="java&#45;quote">&quot;text/css&quot;</span>&gt; &#10;  .errorMessage &#123; color: red; &#125; &#10;&lt;/style&gt;   &#10;&lt;/head&gt; &#10;&#10;&lt;body&gt; &#10;&#10;&lt;p&gt;UI Form Tags Example:&lt;/p&gt; &#10;&#10;&lt;table&gt; &#10;&lt;form &#10;action=<span class="java&#45;quote">&quot;formProcessing.action&quot;</span> method=<span class="java&#45;quote">&quot;post&quot;</span> &gt; &#10;&#10;   &#10;&#10;&#10;&lt;tr&gt; &#10;&lt;td valign=<span class="java&#45;quote">&quot;top&quot;</span> colspan=<span class="java&#45;quote">&quot;2&quot;</span>&gt; &#10;&#10;&lt;table width=<span class="java&#45;quote">&quot;100&#37;&quot;</span> border=<span class="java&#45;quote">&quot;0&quot;</span> cellpadding=<span class="java&#45;quote">&quot;0&quot;</span> cellspacing=<span class="java&#45;quote">&quot;0&quot;</span>&gt; &#10;&lt;tr&gt;&lt;td valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt; &#10;&lt;input type=<span class="java&#45;quote">&quot;checkbox&quot;</span> &#10;name=<span class="java&#45;quote">&quot;checkbox&quot;</span> &#10;value=<span class="java&#45;quote">&quot;checkbox&#95;value&quot;</span> &#10;/&gt; &#10;&lt;/td&gt; &#10;&lt;td width=<span class="java&#45;quote">&quot;100&#37;&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt; &#10;&lt;span class=<span class="java&#45;quote">&quot;checkboxLabel&quot;</span>&gt; &#10;A checkbox &#10;&lt;/span&gt; &#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&lt;/table&gt; &#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&#10;   &#10;&#10;&#10;&#10;&lt;tr&gt; &#10;&lt;td align=<span class="java&#45;quote">&quot;right&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt; &#10;&#10;&lt;span class=<span class="java&#45;quote">&quot;label&quot;</span>&gt; &#10;&#10;A file field: &#10;&lt;/span&gt; &#10;&lt;/td&gt; &#10;&#10;&lt;td&gt; &#10;&#10;&lt;input type=<span class="java&#45;quote">&quot;file&quot;</span> &#10;name=<span class="java&#45;quote">&quot;file&quot;</span> &#10;/&gt; &#10;&#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&#10;  &lt;input &#10;type=<span class="java&#45;quote">&quot;hidden&quot;</span> &#10;name=<span class="java&#45;quote">&quot;hidden&quot;</span> value=<span class="java&#45;quote">&quot;hidden&#95;value&quot;</span> /&gt; &#10;   &#10;&#10;&#10;&#10;&lt;tr&gt; &#10;&lt;td align=<span class="java&#45;quote">&quot;right&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt; &#10;&#10;&lt;span class=<span class="java&#45;quote">&quot;label&quot;</span>&gt; &#10;&#10;A label: &#10;&lt;/span&gt; &#10;&lt;/td&gt; &#10;&#10;&lt;td&gt; &#10;&lt;label&gt; &lt;/label&gt; &#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&#10;   &#10;&#10;&#10;&#10;&#10;&lt;tr&gt; &#10;&lt;td align=<span class="java&#45;quote">&quot;right&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt; &#10;&#10;&lt;span class=<span class="java&#45;quote">&quot;label&quot;</span>&gt; &#10;&#10;A password field: &#10;&lt;/span&gt; &#10;&lt;/td&gt; &#10;&#10;&lt;td&gt; &#10;&#10;&lt;input type=<span class="java&#45;quote">&quot;password&quot;</span> &#10;name=<span class="java&#45;quote">&quot;password&quot;</span> &#10;&#10;&#10;/&gt; &#10;&#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&#10;   &#10;&#10;&#10;&#10;&lt;tr&gt; &#10;&lt;td align=<span class="java&#45;quote">&quot;right&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt; &#10;&#10;&lt;span class=<span class="java&#45;quote">&quot;label&quot;</span>&gt; &#10;&#10;Radio buttons: &#10;&lt;/span&gt; &#10;&lt;/td&gt; &#10;&#10;&lt;td&gt; &#10;&#10;&#10;&#10;&#10;&#10;&lt;input &#10;type=<span class="java&#45;quote">&quot;radio&quot;</span> &#10;name=<span class="java&#45;quote">&quot;radio&quot;</span> &#10;id=<span class="java&#45;quote">&quot;radioOne&quot;</span> &#10;value=<span class="java&#45;quote">&quot;One&quot;</span> /&gt; &#10;&lt;label <span class="java&#45;keyword">for</span>=<span class="java&#45;quote">&quot;radioOne&quot;</span>&gt;One&lt;/label&gt; &#10;&#10;&#10;&#10;&#10;&#10;&lt;input &#10;type=<span class="java&#45;quote">&quot;radio&quot;</span> &#10;name=<span class="java&#45;quote">&quot;radio&quot;</span> &#10;id=<span class="java&#45;quote">&quot;radioTwo&quot;</span> &#10;value=<span class="java&#45;quote">&quot;Two&quot;</span> /&gt; &#10;&lt;label <span class="java&#45;keyword">for</span>=<span class="java&#45;quote">&quot;radioTwo&quot;</span>&gt;Two&lt;/label&gt; &#10;&#10;&#10;&#10;&#10;&#10;&lt;input &#10;type=<span class="java&#45;quote">&quot;radio&quot;</span> &#10;name=<span class="java&#45;quote">&quot;radio&quot;</span> &#10;id=<span class="java&#45;quote">&quot;radioThree&quot;</span> &#10;value=<span class="java&#45;quote">&quot;Three&quot;</span> /&gt; &#10;&lt;label <span class="java&#45;keyword">for</span>=<span class="java&#45;quote">&quot;radioThree&quot;</span>&gt;Three&lt;/label&gt; &#10;&#10;&#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&#10;   &#10;&#10;&#10;&#10;&lt;tr&gt; &#10;&lt;td align=<span class="java&#45;quote">&quot;right&quot;</span> valign=<span class="java&#45;quote">&quot;top&quot;</span>&gt; &#10;&#10;&lt;span class=<span class="java&#45;quote">&quot;label&quot;</span>&gt; &#10;&#10;A select list: &#10;&lt;/span&gt; &#10;&lt;/td&gt; &#10;&#10;&lt;td&gt; &#10;&#10;&lt;select name=<span class="java&#45;quote">&quot;select&quot;</span> &#10;&gt; &#10;&#10;&#10;&lt;option value=<span class="java&#45;quote">&quot;&quot;&gt;&lt;/option&gt; &#10;&#10;&#10;&#10;&#10;&#10;&lt;option value=&quot;</span>One<span class="java&#45;quote">&quot; &#10;&gt;One&lt;/option&gt; &#10;&#10;&#10;&#10;&#10;&#10;&lt;option value=&quot;</span>Two<span class="java&#45;quote">&quot; &#10;&gt;Two&lt;/option&gt; &#10;&#10;&#10;&#10;&#10;&#10;&lt;option value=&quot;</span>Three<span class="java&#45;quote">&quot; &#10;&gt;Three&lt;/option&gt; &#10;&#10;&#10;&lt;/select&gt; &#10;&#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&#10;   &#10;&#10;&#10;&#10;&lt;tr&gt; &#10;&lt;td align=&quot;</span>right<span class="java&#45;quote">&quot; valign=&quot;</span>top<span class="java&#45;quote">&quot;&gt; &#10;&#10;&lt;span class=&quot;</span>label<span class="java&#45;quote">&quot;&gt; &#10;&#10;A text area: &#10;&lt;/span&gt; &#10;&lt;/td&gt; &#10;&#10;&lt;td&gt; &#10;&#10;&lt;textarea name=&quot;</span>textarea<span class="java&#45;quote">&quot; &#10;cols=&quot;</span>40<span class="java&#45;quote">&quot; &#10;rows=&quot;</span>3<span class="java&#45;quote">&quot; &#10;&gt;&lt;/textarea&gt; &#10;&#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&#10;   &#10;&#10;&#10;&#10;&lt;tr&gt; &#10;&lt;td align=&quot;</span>right<span class="java&#45;quote">&quot; valign=&quot;</span>top<span class="java&#45;quote">&quot;&gt; &#10;&#10;&lt;span class=&quot;</span>label<span class="java&#45;quote">&quot;&gt; &#10;&#10;A text field: &#10;&lt;/span&gt; &#10;&lt;/td&gt; &#10;&#10;&lt;td&gt; &#10;&#10;&lt;input type=&quot;</span>text<span class="java&#45;quote">&quot; &#10;name=&quot;</span>textfield<span class="java&#45;quote">&quot; &#10;/&gt; &#10;&#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&#10;  &lt;tr&gt; &#10;&lt;td colspan=&quot;</span>2<span class="java&#45;quote">&quot;&gt;&lt;div &#10;align=&quot;</span>right<span class="java&#45;quote">&quot; &gt;&lt;input &#10;type=&quot;</span>submit<span class="java&#45;quote">&quot; &#10;value=&quot;</span>Send Form&quot; /&gt;&lt;/div&gt; &#10;&lt;/td&gt; &#10;&lt;/tr&gt; &#10;&#10;&lt;/form&gt; &#10;&lt;/table&gt; &#10;&#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-01-01-xwork.xml%3A"> xwork.xml:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span> &#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Include webwork defaults (from WebWork&#45;2.1 JAR). &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;include file=<span class="xml&#45;quote">&quot;webwork&#45;default.xml&quot;</span> /&gt;</span>&#10;	&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Configuration for the default package. &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;default&quot;</span> extends=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;formProcessing&quot;</span> class=<span class="xml&#45;quote">&quot;lesson04&#95;01&#95;01.FormProcessingAction&quot;</span>&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;input&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>ex01&#45;index.jsp<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>ex01&#45;success.jsp<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;validationWorkflowStack&quot;</span> /&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/action&gt;</span>&#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-01-FormProcessingAction.java%3A"> FormProcessingAction.java:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">package</span> lesson04&#95;01&#95;01;&#10;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.ActionSupport;&#10;&#10;<span class="java&#45;keyword">public</span> class FormProcessingAction <span class="java&#45;keyword">extends</span> ActionSupport &#123;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> checkbox;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> file;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> hidden;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> password;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> radio;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> select;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> textarea;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> textfield;&#10;	&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getCheckbox() &#123; <span class="java&#45;keyword">return</span> checkbox; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getFile() &#123; <span class="java&#45;keyword">return</span> file; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getHidden() &#123; <span class="java&#45;keyword">return</span> hidden; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getPassword() &#123; <span class="java&#45;keyword">return</span> password; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getRadio() &#123; <span class="java&#45;keyword">return</span> radio; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getSelect() &#123; <span class="java&#45;keyword">return</span> select; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getTextarea() &#123; <span class="java&#45;keyword">return</span> textarea; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getTextfield() &#123; <span class="java&#45;keyword">return</span> textfield; &#125;&#10;	&#10;	<span class="java&#45;keyword">public</span> void setCheckbox(<span class="java&#45;object">String</span> checkbox) &#123; <span class="java&#45;keyword">this</span>.checkbox = checkbox; &#125;&#10;	<span class="java&#45;keyword">public</span> void setFile(<span class="java&#45;object">String</span> file) &#123; <span class="java&#45;keyword">this</span>.file = file; &#125;&#10;	<span class="java&#45;keyword">public</span> void setHidden(<span class="java&#45;object">String</span> hidden) &#123; <span class="java&#45;keyword">this</span>.hidden = hidden; &#125;&#10;	<span class="java&#45;keyword">public</span> void setPassword(<span class="java&#45;object">String</span> password) &#123; <span class="java&#45;keyword">this</span>.password = password; &#125;&#10;	<span class="java&#45;keyword">public</span> void setRadio(<span class="java&#45;object">String</span> radio) &#123; <span class="java&#45;keyword">this</span>.radio = radio; &#125;&#10;	<span class="java&#45;keyword">public</span> void setSelect(<span class="java&#45;object">String</span> select) &#123; <span class="java&#45;keyword">this</span>.select = select; &#125;&#10;	<span class="java&#45;keyword">public</span> void setTextarea(<span class="java&#45;object">String</span> textarea) &#123; <span class="java&#45;keyword">this</span>.textarea = textarea; &#125;&#10;	<span class="java&#45;keyword">public</span> void setTextfield(<span class="java&#45;object">String</span> textfield) &#123; <span class="java&#45;keyword">this</span>.textfield = textfield; &#125;&#10;	&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> execute() <span class="java&#45;keyword">throws</span> Exception &#123;&#10;		<span class="java&#45;keyword">return</span> SUCCESS;&#10;	&#125;&#10;&#125;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-01-01-FormProcessingActionvalidation.xml%3A"> FormProcessingAction-validation.xml:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE validators PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork Validator 1.0//EN&quot;</span>&#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;validator&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;validators&gt;</span>&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;checkbox&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please, check the checkbox.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;file&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please select a file.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;password&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please type something in the password field.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;radio&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please select a radio button.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;select&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please select an option from the list.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;textarea&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please type something in the text area.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;textfield&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please type something in the text field.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;<span class="xml&#45;tag">&lt;/validators&gt;</span></pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-01-ex01success.jsp%3A"> ex01-success.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;&#37;&#64; taglib uri=<span class="java&#45;quote">&quot;webwork&quot;</span> prefix=<span class="java&#45;quote">&quot;ww&quot;</span> &#37;&gt;&#10;&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.1.1 &#45; Example 1&lt;/title&gt;&#10;&lt;/head&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;p&gt;UI Form Tags Example result:&lt;/p&gt;&#10;&#10;&lt;ul&gt;&#10;  &lt;li&gt;checkbox: &lt;ww:property value=<span class="java&#45;quote">&quot;checkbox&quot;</span> /&gt;&lt;/li&gt;&#10;  &lt;li&gt;&#102;ile: &lt;ww:property value=<span class="java&#45;quote">&quot;file&quot;</span> /&gt;&lt;/li&gt;&#10;  &lt;li&gt;hidden: &lt;ww:property value=<span class="java&#45;quote">&quot;hidden&quot;</span> /&gt;&lt;/li&gt;&#10;  &lt;li&gt;password: &lt;ww:property value=<span class="java&#45;quote">&quot;password&quot;</span> /&gt;&lt;/li&gt;&#10;  &lt;li&gt;radio: &lt;ww:property value=<span class="java&#45;quote">&quot;radio&quot;</span> /&gt;&lt;/li&gt;&#10;  &lt;li&gt;select: &lt;ww:property value=<span class="java&#45;quote">&quot;select&quot;</span> /&gt;&lt;/li&gt;&#10;  &lt;li&gt;textarea: &lt;ww:property value=<span class="java&#45;quote">&quot;textarea&quot;</span> /&gt;&lt;/li&gt;&#10;  &lt;li&gt;textfield: &lt;ww:property value=<span class="java&#45;quote">&quot;textfield&quot;</span> /&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div></p>Notice how much cleaner <tt class="monospaced">ex01-index.jsp</tt> is, compared to its HTML result. The default layout of the form components is a table layout, with the label on the left column and the field to the right. You can learn how to create your own layouts when we explain the template system, below.<p class="paragraph">Another thing to notice is the reference to the <tt class="monospaced">validationWorkflowStack</tt> in the action&#039;s configuration. This makes WebWork validate the parameters that are sent to our actions according to a configuration file we place in the same location as the action class &#8211; in our case, <tt class="monospaced">FormProcessingAction-validation.xml</tt> (see <a href="Validation.html" title="Validation">Validation</a>). In case something is not valid, it prevents the action from executing and dispatches the request to the input result with error messages attached to each field (using the method <tt class="monospaced">addFieldError(String fieldName, String errorMessage)</tt>).</p>But don&#039;t worry about how the validation framework works for now. Run the example and try leaving some fields blank. You will see that the UI tags provide error messages that integrate with the validation framework and that&#039;s what we want do demonstrate here. This separation of concerns can help programmers and designers concentrate more on their part of the work.<br/>
+
+<blockquote class="blockquote"> Read more: <a href="UI Tags.html" title="UI Tags">UI Tags</a></blockquote><br/>
+
+<blockquote class="blockquote"> <a href="TutorialExamples.html" title="TutorialExamples">Try the example!</a></blockquote>
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson04-01-01-OtherUIControls%3A"> Other UI Controls:</a></h2></p>Besides the standard form controls that HTML designers are already familiar with, WebWork provides some other controls and also the ability to create a custom control. Let&#039;s take a look at the custom controls that are already provided by WebWork: <br/>
+
+<table class="wikitable">
+<tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:checkboxlist /&gt;</tt></b></td><td>Works just like the <tt class="monospaced">&lt;ww:radio /&gt;</tt> tag, but with check boxes instead of radio buttons. It gets the keys and values from a collection and creates a list of checkboxes, all with the same name.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:combobox /&gt;</tt></b></td><td>Simulates a combo box, which is a control that mixes a selection list with a text field. It does this by placing a text field with a <tt class="monospaced">&lt;select /&gt;</tt> list right below it and a JavaScript code that fills the text field with the selection of the list every time it changes.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:tabbedpane /&gt;</tt></b></td><td><em class="emphasis">Help needed here.</em></td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:token /&gt;</tt></b></td><td><em class="emphasis">Help needed here.</em></td>
+</tr>
+</table><br/>
+<blockquote class="blockquote"> Read more: <a href="UI Tags.html" title="UI Tags">UI Tags</a></blockquote>
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson04-01-01-TheTemplateSystem%3A"> The Template System:</a></h2></p>WebWork uses the Velocity template system to render the actual HTML output for all UI tags. A default implementation of all templates has been included with the core distribution allowing users to use WebWork&#039;s UI tags &quot;out of the box&quot;. Templates can be edited individually or replaced entirely allowing for complete customization of the resulting HTML output. In addition, the default template can be overridden on a per tag basis allowing for a very fine level of control. The default templates are located in the <tt class="monospaced">webwork-2.1.jar</tt> file under <tt class="monospaced">/template/xhtml</tt>.<p class="paragraph">If you unpack <tt class="monospaced">webwork-2.1.jar</tt> and look under the <tt class="monospaced">/template/xhtml</tt> directory you will see a bunch of velocity templates. Most of them correspond to a specific UI Tag, and those have the name of the tag they render. If you&#039;re familiar with Velocity, I recommend you analyse the template files to see what you&#039;re capable of doing with them. Since version 2.1, there&#039;s also a <tt class="monospaced">/template/simple</tt> directory, which is a simpler version of the HTML form controls (just the control, no table or label).</p>If you want do display your UI components in a different layout than the one that comes with WebWork, you can:<br/>
+
+<ul class="star">
+<li> Edit and replace the files in <tt class="monospaced">/template/xhtml</tt> (repack the JAR or create the same directory structure somewhere else and make sure your container looks that path before the JAR);</li>
+</ul>
+<ul class="star">
+<li> Change the location of the templates by editing the <tt class="monospaced">webwork.ui.theme</tt> property in <tt class="monospaced">webwork.properties</tt> (file that should be placed in the root of your classpath);</li>
+</ul>
+<ul class="star">
+<li> Specifying the location of the templates for each tag individually using the theme or the template property. The former allows you to specify the directory where all templates are (thus, WebWork looks for templates with the same name as the ones in <tt class="monospaced">/template/xhtml</tt>), while the latter allows you to indicate the exact template to be used for that component.</li>
+</ul><br/>
+<blockquote class="blockquote"> Read more: <a href="Templates.html" title="Templates">Templates</a>, <a href="Themes.html" title="Themes">Themes</a></blockquote><p class="paragraph">The third approach is demonstrated in the example below.</p><h3 class="heading3"><a name="TutorialLesson04-01-01-ex02.jsp%3A"> ex02.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;&#37;&#64; taglib uri=<span class="java&#45;quote">&quot;webwork&quot;</span> prefix=<span class="java&#45;quote">&quot;ww&quot;</span> &#37;&gt; &#10;&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.1.1 &#45; Example 2&lt;/title&gt; &#10;&lt;/head&gt; &#10;&#10;&lt;body&gt; &#10;&#10;&lt;p&gt;Template Change Example:&lt;/p&gt; &#10;&#10;&lt;p&gt;&lt;ww:checkbox name=<span class="java&#45;quote">&quot;&#039;checkbox&#039;&quot;</span> label=<span class="java&#45;quote">&quot;&#039;A checkbox&#039;&quot;</span> &#10;fieldValue=<span class="java&#45;quote">&quot;&#039;checkbox&#95;value&#039;&quot;</span> theme=<span class="java&#45;quote">&quot;/files/templates/components&quot;</span> /&gt;&lt;/p&gt; &#10;&#10;&lt;p&gt;&lt;ww:textfield name=<span class="java&#45;quote">&quot;&#039;textfield&#039;&quot;</span> label=<span class="java&#45;quote">&quot;&#039;A text field&#039;&quot;</span> &#10;template=<span class="java&#45;quote">&quot;/files/templates/components/mytextfield.vm&quot;</span> /&gt;&lt;/p&gt; &#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-01-%2Ffiles%2Ftemplates%2Fcomponents%2Fcheckbox.vm%3A"> /files/templates/components/checkbox.vm:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;div align=<span class="java&#45;quote">&quot;center&quot;</span>&gt; &#10;	&lt;input type=<span class="java&#45;quote">&quot;checkbox&quot;</span> &#10;		name=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.name)&quot;</span> &#10;		value=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.fieldValue)&quot;</span> &#10;	#<span class="java&#45;keyword">if</span> ($parameters.nameValue) checked=<span class="java&#45;quote">&quot;checked&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.disabled == <span class="java&#45;keyword">true</span>) disabled=<span class="java&#45;quote">&quot;disabled&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.tabindex) tabindex=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.tabindex)&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.onchange) onchange=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.onchange)&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.id) id=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.id)&quot;</span> #end &#10;	/&gt;&lt;br /&gt; &#10;	$&#33;webwork.htmlEncode($parameters.label) &#10;&lt;/div&gt;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-01-01-%2Ffiles%2Ftemplates%2Fcomponents%2Fmytextfield.vm%3A"> /files/templates/components/mytextfield.vm:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;div align=<span class="java&#45;quote">&quot;center&quot;</span>&gt; &#10;	&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> &#10;		name=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.name)&quot;</span> &#10;	#<span class="java&#45;keyword">if</span> ($parameters.size) size=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.size)&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.maxlength) maxlength=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.maxlength)&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.nameValue) value=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.nameValue)&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.disabled == <span class="java&#45;keyword">true</span>) disabled=<span class="java&#45;quote">&quot;disabled&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.readonly) readonly=<span class="java&#45;quote">&quot;readonly&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.onkeyup) onkeyup=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.onkeyup)&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.tabindex) tabindex=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.tabindex)&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.onchange) onchange=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.onchange)&quot;</span> #end &#10;	#<span class="java&#45;keyword">if</span> ($parameters.id) id=<span class="java&#45;quote">&quot;$&#33;webwork.htmlEncode($parameters.id)&quot;</span> #end &#10;	/&gt;&lt;br /&gt; &#10;	$&#33;webwork.htmlEncode($parameters.label) &#10;&lt;/div&gt;</pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-01-HTMLresultafterprocessingex02.jsp%3A"> HTML result after processing ex02.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.1.1 &#45; Example 2&lt;/title&gt; &#10;&lt;/head&gt; &#10;&#10;&lt;body&gt; &#10;&#10;&lt;p&gt;Template Change Example:&lt;/p&gt; &#10;&#10;&lt;p&gt;&lt;div align=<span class="java&#45;quote">&quot;center&quot;</span>&gt; &#10;  &lt;input type=<span class="java&#45;quote">&quot;checkbox&quot;</span> &#10;         name=<span class="java&#45;quote">&quot;checkbox&quot;</span> &#10;         value=<span class="java&#45;quote">&quot;checkbox&#95;value&quot;</span> &#10;            /&gt;&lt;br /&gt; &#10;  A checkbox &#10;&lt;/div&gt;&lt;/p&gt; &#10;&#10;&lt;p&gt;&lt;div align=<span class="java&#45;quote">&quot;center&quot;</span>&gt; &#10;  &lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> &#10;                                     name=<span class="java&#45;quote">&quot;textfield&quot;</span> &#10;                    /&gt;&lt;br /&gt; &#10;  A text field &#10;&lt;/div&gt;&lt;/p&gt; &#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div></p><blockquote class="blockquote"> <a href="TutorialExamples.html" title="TutorialExamples">Try the example!</a></blockquote>
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson04-01-01-BuildingCustomizedUIComponents%3A"> Building Customized UI Components:</a></h2></p>There are some situations in which none of the UI Components that come bundled with WebWork fit your requirements. In this case, the recommended approach would be to create your own custom component. In this way, you keep your web page clean of layout and error-checking issues and also promotes component reuse.<p class="paragraph">To create a custom component, just create a Velocity template for it, just like the ones that already exist. To place it in a web page, use the <tt class="monospaced">&lt;ww:component /&gt;</tt> tag and specify the location of the template in its <tt class="monospaced">template</tt> parameter.</p>To pass parameters to be used by your template, use the <tt class="monospaced">&lt;ww:param /&gt;</tt> tag (see <a href="TutorialLesson04-01.html" title="TutorialLesson04-01">lesson 4.1</a>). The example below demonstrates the creation of a custom date field.<br/>
+
+<blockquote class="blockquote"> Read more: <a href="UI Tags.html" title="UI Tags">UI Tags</a></blockquote>
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-01-ex03.jsp%3A"> ex03.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;&#37;&#64; taglib uri=<span class="java&#45;quote">&quot;webwork&quot;</span> prefix=<span class="java&#45;quote">&quot;ww&quot;</span> &#37;&gt; &#10;&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.1.1 &#45; Example 3&lt;/title&gt; &#10;&lt;/head&gt; &#10;&#10;&lt;body&gt; &#10;&lt;p&gt;Custom Component Example:&lt;/p&gt; &#10;&#10;&lt;p&gt; &#10;&lt;ww:component template=<span class="java&#45;quote">&quot;/files/templates/components/datefield.vm&quot;</span>&gt; &#10;	&lt;ww:param name=<span class="java&#45;quote">&quot;label&quot;</span> value=<span class="java&#45;quote">&quot;&#039;Date&#039;&quot;</span> /&gt; &#10;	&lt;ww:param name=<span class="java&#45;quote">&quot;name&quot;</span> value=<span class="java&#45;quote">&quot;&#039;mydatefield&#039;&quot;</span> /&gt; &#10;	&lt;ww:param name=<span class="java&#45;quote">&quot;size&quot;</span> value=<span class="java&#45;quote">&quot;3&quot;</span> /&gt; &#10;&lt;/ww:component&gt; &#10;&lt;/p&gt; &#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-01-01-%2Ffiles%2Ftemplates%2Fcomponents%2Fdatefield.vm%3A"> /files/templates/components/datefield.vm:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>#set ($name = $tag.params.get(&#039;name&#039;)) &#10;#set ($size = $tag.params.get(&#039;size&#039;)) &#10;#set ($yearSize = $size &#42; 2) &#10;&#10;$tag.params.get(&#039;label&#039;): &#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;$&#123;name&#125;.day&quot;</span> size=<span class="java&#45;quote">&quot;$size&quot;</span> /&gt; / &#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;$&#123;name&#125;.month&quot;</span> size=<span class="java&#45;quote">&quot;$size&quot;</span> /&gt; / &#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;$&#123;name&#125;.year&quot;</span> size=<span class="java&#45;quote">&quot;$yearSize&quot;</span> /&gt; (dd/mm/yyyy)</pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-01-HTMLresultafterprocessingex03.jsp%3A"> HTML result after processing ex03.jsp:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.1.1 &#45; Example 3&lt;/title&gt; &#10;&lt;/head&gt; &#10;&#10;&lt;body&gt; &#10;&#10;&lt;p&gt;Custom Component Example:&lt;/p&gt; &#10;&#10;&lt;p&gt; &#10;Date: &#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;mydatefield.day&quot;</span> size=<span class="java&#45;quote">&quot;3&quot;</span> /&gt; / &#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;mydatefield.month&quot;</span> size=<span class="java&#45;quote">&quot;3&quot;</span> /&gt; / &#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;mydatefield.year&quot;</span> size=<span class="java&#45;quote">&quot;6&quot;</span> /&gt; (dd/mm/yyyy) &#10;&#10;&lt;/p&gt; &#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div></p><blockquote class="blockquote"> <a href="TutorialExamples.html" title="TutorialExamples">Try the example!</a></blockquote><p class="paragraph"><hr class="line"/></p><a href="TutorialLesson04-01.html" title="TutorialLesson04-01">Previous Lesson</a> | <a href="TutorialLesson04-02.html" title="TutorialLesson04-02">Next Lesson</a><br/>
+
+
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialLesson04-01.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialLesson04-01</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialLesson04-01
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 09, 2004 by <font color="#0050B2">vitorsouza</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialLesson04-01-Lesson4.1%3AUsingJSPastheView"> Lesson 4.1: Using JSP as the View</a></h1></p>When using JSP to render the views, you can choose to access the action&#039;s data using scriptlets or tags. Tags are the recommended approach.
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson04-01-AccessingActionDatathroughScriplets%3A"> Accessing Action Data through Scriplets:</a></h2></p>Action data can be accessed through an object called <em class="emphasis">Value Stack</em>. The example below does the same thing as the result page of <a href="TutorialLesson03.html" title="TutorialLesson03">lesson 3</a>&#039;s second example (<em class="emphasis">Supplying Data to the Action</em>), but using scriptlets:<br/>
+
+<div class="code"><div class="codeContent">
+<pre>&lt;&#37;&#64; page <span class="java&#45;keyword">import</span>=<span class="java&#45;quote">&quot;com.opensymphony.xwork.util.OgnlValueStack&quot;</span> &#37;&gt;&#10;&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.1 &#45; Lesson 3&#039;s example modified&lt;/title&gt;&#10;&lt;/head&gt;&#10;&lt;body&gt;&#10;&#10;&lt;&#37;&#10;OgnlValueStack stack = (OgnlValueStack)request.getAttribute(<span class="java&#45;quote">&quot;webwork.valueStack&quot;</span>);&#10;out.write(<span class="java&#45;quote">&quot;Hello, &quot;</span> &#43; stack.findValue(<span class="java&#45;quote">&quot;person&quot;</span>));&#10;&#37;&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph">WebWork tags, however, are recommended over scriptlets. For instance, <tt class="monospaced">&lt;ww:property /&gt;</tt> tags do exactly what the scriptlet above does, with a cleaner syntax and also handles the case where the Value Stack doesn&#039;t exist.</p><h2 class="heading2"><a name="TutorialLesson04-01-WebWorkTagLibrary%3A"> WebWork Tag Library:</a></h2><p class="paragraph">We&#039;ve already showed in <a href="TutorialLesson03.html" title="TutorialLesson03">lesson 3</a>&#039;s example how to access an action&#039;s property using tags. This section describes and exemplifies the use of the WebWork Tag Library, which can be divided in seven categories:</p><ul class="star">
+<li> <b class="strong">Common tags</b>: the most frequently used, basic tags;</li>
+<li> <b class="strong">Componentisation tags</b>: foster componentisation within your views;</li>
+<li> <b class="strong">Flow control tags</b>: govern the flow of control within the JSP page;</li>
+<li> <b class="strong">Iteration tags</b>: iterate over elements and manipulate iterable objects;</li>
+<li> <b class="strong">UI tags</b>: generate HTML form fields and controls;</li>
+<li> <b class="strong">VUI tags</b>: <font color="red"><em class="emphasis">volunteers needed to write this part</em></font>;</li>
+<li> <b class="strong">Internationalisation tags</b>: internationalise your views.</li>
+</ul><br/>
+ 
+<h3 class="heading3"><a name="TutorialLesson04-01-Commontags"> Common tags</a></h3>
+
+<table class="wikitable">
+<tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:property /&gt;</tt></b></td><td>Gets the value of a result attribute. If the value isn&#039;t given, the top of the stack will be returned.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:push /&gt;</tt></b></td><td>Pushes a value onto the Value Stack.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:param /&gt;</tt></b></td><td>Sets a parent tag&#039;s parameter. This tag is used only inside another tag to set the value of some property of the parent tag.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:set /&gt;</tt></b></td><td>Sets the value of an object in the Value Stack to a scope (page, stack, application, session). If the value is not given, the top of the stack is used. If the scope is not given, the default scope of &quot;webwork&quot; is used.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:url /&gt;</tt></b></td><td>Builds an encoded URL.</td>
+</tr>
+</table>
+<div class="code"><div class="codeContent">
+<pre>EXAMPLE NEEDED.</pre>
+</div></div><br/>
+
+<blockquote class="blockquote"> Read more: <a href="Non-UI Tags.html" title="Non-UI Tags">Non-UI Tags</a></blockquote>
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-Componentisationtags"> Componentisation tags</a></h3></p><table class="wikitable">
+<tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:action /&gt;</tt></b></td><td>Executes an Action from within the context of a taglib. The body of the tag is used to display the results of the action invocation.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:bean /&gt;</tt></b></td><td>Creates a JavaBean, instantiate its properties and place it in the ActionContext for later use.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:include /&gt;</tt></b></td><td>Includes another page or action.</td>
+</tr>
+</table>
+<div class="code"><div class="codeContent">
+<pre>EXAMPLE NEEDED.</pre>
+</div></div><br/>
+
+<blockquote class="blockquote"> Read more: <a href="Non-UI Tags.html" title="Non-UI Tags">Non-UI Tags</a></blockquote>
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-Flowcontroltags"> Flow control tags</a></h3></p>This if-else set of tags works just like if-else scriptlets.<br/>
+
+<table class="wikitable">
+<tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:if /&gt;</tt></b></td><td>Conditional execution path. That is, evaluates the tag body if a boolean expression is true.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:else /&gt;</tt></b></td><td>Negative execution path for the if tag. That is, if the preceeding conditional tag&#039;s boolean expression evaluated to false, then evaluate this tag&#039;s body.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:elseif /&gt;</tt></b></td><td>Negative conditional execution path for the if tag. That is, if the preceeding conditional tag&#039;s boolean expression evaluated to false and if this tag&#039;s boolean expression evaluates to true, then evaluate this tag&#039;s body.</td>
+</tr>
+</table>
+<div class="code"><div class="codeContent">
+<pre>EXAMPLE NEEDED.</pre>
+</div></div><br/>
+
+<blockquote class="blockquote"> Read more: <a href="Non-UI Tags.html" title="Non-UI Tags">Non-UI Tags</a></blockquote>
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-Iterationtags"> Iteration tags</a></h3></p><table class="wikitable">
+<tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:iterator /&gt;</tt></b></td><td>Iterates over a collection.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:generator /&gt;</tt></b></td><td>Generates iterators.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:append /&gt;</tt></b></td><td>Appends several iterators.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:subset /&gt;</tt></b></td><td>Gets a subset of an iterator.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:merge /&gt;</tt></b></td><td>Merges several iterators into one.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:sort /&gt;</tt></b></td><td>Sorts an iterator.</td>
+</tr>
+</table>
+<div class="code"><div class="codeContent">
+<pre>EXAMPLE NEEDED.</pre>
+</div></div><br/>
+
+<blockquote class="blockquote"> Read more: <a href="Non-UI Tags.html" title="Non-UI Tags">Non-UI Tags</a></blockquote>
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-UItags"> UI tags</a></h3></p>The UI tags wrap generic HTML controls while providing tight integration with the core framework. The tags have been designed to minimize the amount of logic in compiled code and delegate the actual rendering of HTML to a template system. The UI tags attempt to cover the most common scenarios, while providing a Component Tag for creating custom components. The UI tags also provide built-in support for displaying inline error messages.<p class="paragraph">There is a separate lesson about WebWork UI Tags which explains in detail how they work, how you could cusomize their appearance through the use of templates, how to create custom components, etc.</p><a href="TutorialLesson04-01-01.html" title="TutorialLesson04-01-01">Go to WebWork UI Tags Lesson</a>.
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-01-VUItags"> VUI tags</a></h3>
+<font color="red"><em class="emphasis">Volunteers needed to write this part.</em></font></p><h3 class="heading3"><a name="TutorialLesson04-01-Internationalisationtags"> Internationalisation tags</a></h3>
+
+<table class="wikitable">
+<tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:text /&gt;</tt></b></td><td>Prints out an internationalized string.</td>
+</tr><tr>
+<td><b class="strong"><tt class="monospaced">&lt;ww:i18n /&gt;</tt></b></td><td>Places a resource bundle on the Value Stack, for access by the text tag.</td>
+</tr>
+</table><br/>
+<blockquote class="blockquote"> Read more: <a href="UI Tags.html" title="UI Tags">UI Tags</a></blockquote><p class="paragraph"><hr class="line"/></p><a href="TutorialLesson04.html" title="TutorialLesson04">Previous Lesson</a> | <a href="TutorialLesson04-02.html" title="TutorialLesson04-02">Next Lesson</a><br/>
+
+
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialLesson04-02.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialLesson04-02</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialLesson04-02
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 14, 2004 by <font color="#0050B2">vitorsouza</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialLesson04-02-Lesson4.2%3AUsingVelocitywithWebWork"> Lesson 4.2: Using Velocity with WebWork</a></h1></p>There are two ways of using Velocity as the view.<br/>
+
+<ul class="star">
+<li> Using the <tt class="monospaced">velocity</tt> result-type to render velocity templates;</li>
+<li> Registering <tt class="monospaced">WebWorkVelocityServlet</tt> in your <tt class="monospaced">web.xml</tt> file to render Velocity templates accessed directly through browser requests.</li>
+</ul><br/>
+To use the second approach, we have to modify <tt class="monospaced">web.xml</tt> and add a servlet and a servlet mapping for <tt class="monospaced">WebWorkVelocityServlet</tt>, as demonstrated below:<br/>
+
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;servlet&gt;</span> &#10;	<span class="xml&#45;tag">&lt;servlet&#45;name&gt;</span>velocity<span class="xml&#45;tag">&lt;/servlet&#45;name&gt;</span> &#10;	<span class="xml&#45;tag">&lt;servlet&#45;class&gt;</span>com.opensymphony.webwork.views.velocity.WebWorkVelocityServlet<span class="xml&#45;tag">&lt;/servlet&#45;class&gt;</span> &#10;	<span class="xml&#45;tag">&lt;load&#45;on&#45;startup&gt;</span>1<span class="xml&#45;tag">&lt;/load&#45;on&#45;startup&gt;</span> &#10;<span class="xml&#45;tag">&lt;/servlet&gt;</span> &#10;&#10;<span class="xml&#45;tag">&lt;servlet&#45;mapping&gt;</span> &#10;	<span class="xml&#45;tag">&lt;servlet&#45;name&gt;</span>velocity<span class="xml&#45;tag">&lt;/servlet&#45;name&gt;</span> &#10;	<span class="xml&#45;tag">&lt;url&#45;pattern&gt;</span>&#42;.vm<span class="xml&#45;tag">&lt;/url&#45;pattern&gt;</span> &#10;<span class="xml&#45;tag">&lt;/servlet&#45;mapping&gt;</span></pre>
+</div></div><br/>
+
+<blockquote class="blockquote"> Read more: <a href="xwork.xml.html" title="xwork.xml">xwork.xml</a></blockquote><p class="paragraph">Using <tt class="monospaced">velocity</tt> result-type means that Velocity templates can only be rendered through an action, i.e., request to <tt class="monospaced">.vm</tt> pages will not render the file and it will be returned as plain text. If you choose this approach, it&#039;s recommended that you place your Velocity files under <tt class="monospaced">WEB-INF</tt> so they become unaccessible.</p>Using <tt class="monospaced">WebWorkVelocityServlet</tt> means that Velocity templates can be rendered through requests to <tt class="monospaced">.vm</tt> pages. That also means that you should implement security checks in your templates so an user doesn&#039;t access it directly witout going through an action first (if that is required). <p class="paragraph">No matter which approach you choose (and you can choose to use both at the same time), not only all the features from Velocity are available to you when you&#039;re writing templates, but also some other functionalities, specific of WebWork, are available. It is supposed that you are already familiar with Velocity, so we will focus only in the WebWork-specific features. If that&#039;s not the case, please <a href="http://jakarta.apache.org/velocity/getting-started.html" title="Visit page outside Confluence">get started with Velocity</a> before continuing.</p>The main feature of it is to provide easy access to objects that are on the Value Stack, which contains some things that WebWork provides to you automatically, because you may find them useful at some point. These are some of the things that are available in the value stack:<br/>
+
+<ul class="star">
+<li> The current <tt class="monospaced">HttpServletRequest</tt>;</li>
+<li> The current <tt class="monospaced">HttpServletResponse</tt>;</li>
+<li> The current <tt class="monospaced">OgnlValueStack</tt>;</li>
+<li> An instance of <tt class="monospaced">OgnlTool</tt>;</li>
+<li> All the properties of the current action class.</li>
+</ul><br/>
+To access the objects in the value stack, all you have to do is use appropriate Velocity references:<br/>
+
+<ul class="star">
+<li> <b class="strong"><tt class="monospaced">$req</tt></b> = <tt class="monospaced">HttpServletRequest</tt>;</li>
+<li> <b class="strong"><tt class="monospaced">$res</tt></b> = <tt class="monospaced">HttpServletResponse</tt>;</li>
+<li> <b class="strong"><tt class="monospaced">$stack</tt></b> = <tt class="monospaced">OgnlValueStack</tt>;</li>
+<li> <b class="strong"><tt class="monospaced">$ognl</tt></b> = <tt class="monospaced">OgnlTool</tt>;</li>
+<li> <b class="strong"><tt class="monospaced">$name-of-property</tt></b> = property of the current action class.</li>
+</ul><br/>
+The example below does the same thing as the Hello example from <a href="TutorialLesson03.html" title="TutorialLesson03">lesson 3</a>, but now, using a Velocity template as the result. Notice that the <tt class="monospaced">&lt;property value=&quot;person&quot; /&gt;</tt> tag was replaced by the <tt class="monospaced">$person</tt> reference, which returns the same thing: a property from the action class. In this example we chose to use the <em class="emphasis"><tt class="monospaced">velocity</tt> result-type</em> approach.<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-02-xwork.xml%3A"> xwork.xml:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span> &#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Include webwork defaults (from WebWork&#45;2.1 JAR). &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;include file=<span class="xml&#45;quote">&quot;webwork&#45;default.xml&quot;</span> /&gt;</span>&#10;	&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Configuration for the default package. &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;default&quot;</span> extends=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Default interceptor stack. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;default&#45;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;defaultStack&quot;</span> /&gt;</span> &#10;		&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Action: Lesson 4.2: HelloAction using Velocity as result. &#45;&#45;&gt;</span></span>&#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;helloVelocity&quot;</span> class=<span class="xml&#45;quote">&quot;lesson03.HelloAction&quot;</span>&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;error&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>ex01&#45;index.jsp<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;velocity&quot;</span>&gt;</span>ex01&#45;success.vm<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/action&gt;</span>&#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-02-HelloAction.java%28sameaslesson3%29%3A"> HelloAction.java (same as lesson 3):</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">package</span> lesson03;&#10;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.ActionSupport;&#10;&#10;<span class="java&#45;keyword">public</span> class HelloAction <span class="java&#45;keyword">extends</span> ActionSupport &#123;&#10;	<span class="java&#45;object">String</span> person;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getPerson() &#123;&#10;		<span class="java&#45;keyword">return</span> person;&#10;	&#125;&#10;	<span class="java&#45;keyword">public</span> void setPerson(<span class="java&#45;object">String</span> person) &#123;&#10;		<span class="java&#45;keyword">this</span>.person = person;&#10;	&#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> execute() <span class="java&#45;keyword">throws</span> Exception &#123;&#10;		<span class="java&#45;keyword">if</span> ((person == <span class="java&#45;keyword">null</span>) || (person.length() == 0)) <span class="java&#45;keyword">return</span> ERROR;&#10;		<span class="java&#45;keyword">else</span>&#160;<span class="java&#45;keyword">return</span> SUCCESS;&#10;	&#125;&#10;&#125;</pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-02-ex01index.jsp%28sameaslesson3%29%3A"> ex01-index.jsp (same as lesson 3):</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 3 &#45; Example 2&lt;/title&gt;&#10;&lt;/head&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;p&gt;What&#039;s your name&#63;&lt;/p&gt;&#10;&#10;&lt;form action=<span class="java&#45;quote">&quot;hello.action&quot;</span> method=<span class="java&#45;quote">&quot;post&quot;</span>&gt;&#10;&lt;p&gt;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;person&quot;</span> /&gt;&lt;input type=<span class="java&#45;quote">&quot;submit&quot;</span> /&gt;&lt;/p&gt;&#10;&lt;/form&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-02-ex01success.vm%3A"> ex01-success.vm:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.2 &#45; Example 1&lt;/title&gt; &#10;&lt;/head&gt; &#10;&lt;body&gt; &#10;&#10;Hello, $person &#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div><br/>
+
+<blockquote class="blockquote"> <a href="TutorialExamples.html" title="TutorialExamples">Try the example!</a></blockquote>
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson04-02-UsingWebWorkTagsfromVelocity%3A"> Using WebWork Tags from Velocity:</a></h2></p>As you already know, when you switch from JSP to Velocity you lose the ability of using JSP Tags. But WebWork&#039;s Velocity Servlet provides a way of doing this through the use of <tt class="monospaced">#tag</tt>, <tt class="monospaced">#bodytag</tt> and <tt class="monospaced">#param</tt> velocimacros. The general syntax is:<br/>
+
+<div class="code"><div class="codeContent">
+<pre>#tag (name&#45;of&#45;tag list&#45;of&#45;attributes)</pre>
+</div></div><p class="paragraph">&#8211; or &#8211;</p><div class="code"><div class="codeContent">
+<pre>#bodytag (name&#45;of&#45;tag list&#45;of&#45;attributes)&#10;	#param (key value)&#10;	#param (key value)&#10;...&#10;#end</pre>
+</div></div><p class="paragraph">Let&#039;s revisit <a href="TutorialLesson04-01-01.html" title="TutorialLesson04-01-01">lesson 4.1.1</a>&#039;s form example to demonstrate the usage of the UI tags from velocity:</p><h3 class="heading3"><a name="TutorialLesson04-02-xwork.xml%3A"> xwork.xml:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span> &#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Include webwork defaults (from WebWork&#45;2.1 JAR). &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;include file=<span class="xml&#45;quote">&quot;webwork&#45;default.xml&quot;</span> /&gt;</span>&#10;	&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Configuration for the default package. &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;default&quot;</span> extends=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Default interceptor stack. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;default&#45;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;defaultStack&quot;</span> /&gt;</span> &#10;		&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Actions: Lesson 4.2: FormProcessingAction using Velocity. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;formProcessingVelocityIndex&quot;</span> class=<span class="xml&#45;quote">&quot;lesson04&#95;02.FormProcessingIndexAction&quot;</span>&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;velocity&quot;</span>&gt;</span>ex02&#45;index.vm<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/action&gt;</span>&#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;formProcessingVelocity&quot;</span> class=<span class="xml&#45;quote">&quot;lesson04&#95;01&#95;01.FormProcessingAction&quot;</span>&gt;</span> &#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;input&quot;</span> type=<span class="xml&#45;quote">&quot;velocity&quot;</span>&gt;</span>ex02&#45;index.vm<span class="xml&#45;tag">&lt;/result&gt;</span> &#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;velocity&quot;</span>&gt;</span>ex02&#45;success.vm<span class="xml&#45;tag">&lt;/result&gt;</span> &#10;			<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;validationWorkflowStack&quot;</span> /&gt;</span> &#10;		<span class="xml&#45;tag">&lt;/action&gt;</span> &#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-02-ex02index.vm%3A"> ex02-index.vm:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.2 &#45; Example 2&lt;/title&gt; &#10;&lt;style type=<span class="java&#45;quote">&quot;text/css&quot;</span>&gt; &#10;  .errorMessage &#123; color: red; &#125; &#10;&lt;/style&gt;   &#10;&lt;/head&gt; &#10;&#10;&lt;body&gt; &#10;&#10;&lt;p&gt;UI Form Tags Example using Velocity:&lt;/p&gt; &#10;&#10;#bodytag (Form <span class="java&#45;quote">&quot;action=&#039;formProcessingVelocity.action&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;method=&#039;post&#039;&quot;</span>) &#10;	#tag (Checkbox <span class="java&#45;quote">&quot;name=&#039;checkbox&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;label=&#039;A checkbox&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;fieldValue=&#039;checkbox&#95;value&#039;&quot;</span>) &#10;	#tag (File <span class="java&#45;quote">&quot;name=&#039;file&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;label=&#039;A file field&#039;&quot;</span>) &#10;	#tag (Hidden <span class="java&#45;quote">&quot;name=&#039;hidden&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;value=&#039;hidden&#95;value&#039;&quot;</span>) &#10;	#tag (Label <span class="java&#45;quote">&quot;label=&#039;A label&#039;&quot;</span>) &#10;	#tag (Password <span class="java&#45;quote">&quot;name=&#039;password&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;label=&#039;A password field&#039;&quot;</span>) &#10;	#tag (Radio <span class="java&#45;quote">&quot;name=&#039;radio&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;label=&#039;Radio buttons&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;list=&#123;&#039;One&#039;, &#039;Two&#039;, &#039;Three&#039;&#125;&quot;</span>) &#10;	#tag (Select <span class="java&#45;quote">&quot;name=&#039;select&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;label=&#039;A select list&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;list=&#123;&#039;One&#039;, &#039;Two&#039;, &#039;Three&#039;&#125;&quot;</span> &#10;		<span class="java&#45;quote">&quot;emptyOption=<span class="java&#45;keyword">true</span>&quot;</span>) &#10;	#tag (Textarea <span class="java&#45;quote">&quot;name=&#039;textarea&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;label=&#039;A text area&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;rows=&#039;3&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;cols=&#039;40&#039;&quot;</span>) &#10;	#tag (TextField <span class="java&#45;quote">&quot;name=&#039;textfield&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;label=&#039;A text field&#039;&quot;</span>) &#10;	#tag (Submit <span class="java&#45;quote">&quot;value=&#039;Send Form&#039;&quot;</span>) &#10;#end &#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-02-ex02success.vm%3A"> ex02-success.vm:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial Lesson 4.2 &#45; Example 2&lt;/title&gt; &#10;&lt;/head&gt; &#10;&#10;&lt;body&gt; &#10;&#10;&lt;p&gt;UI Form Tags Example result using Velocity:&lt;/p&gt; &#10;&#10;&lt;ul&gt; &#10;	&lt;li&gt;checkbox: $&#33;checkbox&lt;/li&gt; &#10;	&lt;li&gt;&#102;ile: $&#33;file&lt;/li&gt; &#10;	&lt;li&gt;hidden: $&#33;hidden&lt;/li&gt; &#10;	&lt;li&gt;password: $&#33;password&lt;/li&gt; &#10;	&lt;li&gt;radio: $&#33;radio&lt;/li&gt; &#10;	&lt;li&gt;select: $&#33;select&lt;/li&gt; &#10;	&lt;li&gt;textarea: $&#33;textarea&lt;/li&gt; &#10;	&lt;li&gt;textfield: $&#33;textfield&lt;/li&gt; &#10;&lt;/ul&gt; &#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-02-FormProcessingAction.java%28sameaslesson4.1.1%29%3A"> FormProcessingAction.java (same as lesson 4.1.1):</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">package</span> lesson04&#95;01&#95;01;&#10;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.ActionSupport;&#10;&#10;<span class="java&#45;keyword">public</span> class FormProcessingAction <span class="java&#45;keyword">extends</span> ActionSupport &#123;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> checkbox;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> file;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> hidden;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> password;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> radio;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> select;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> textarea;&#10;	<span class="java&#45;keyword">private</span>&#160;<span class="java&#45;object">String</span> textfield;&#10;	&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getCheckbox() &#123; <span class="java&#45;keyword">return</span> checkbox; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getFile() &#123; <span class="java&#45;keyword">return</span> file; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getHidden() &#123; <span class="java&#45;keyword">return</span> hidden; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getPassword() &#123; <span class="java&#45;keyword">return</span> password; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getRadio() &#123; <span class="java&#45;keyword">return</span> radio; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getSelect() &#123; <span class="java&#45;keyword">return</span> select; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getTextarea() &#123; <span class="java&#45;keyword">return</span> textarea; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getTextfield() &#123; <span class="java&#45;keyword">return</span> textfield; &#125;&#10;	&#10;	<span class="java&#45;keyword">public</span> void setCheckbox(<span class="java&#45;object">String</span> checkbox) &#123; <span class="java&#45;keyword">this</span>.checkbox = checkbox; &#125;&#10;	<span class="java&#45;keyword">public</span> void setFile(<span class="java&#45;object">String</span> file) &#123; <span class="java&#45;keyword">this</span>.file = file; &#125;&#10;	<span class="java&#45;keyword">public</span> void setHidden(<span class="java&#45;object">String</span> hidden) &#123; <span class="java&#45;keyword">this</span>.hidden = hidden; &#125;&#10;	<span class="java&#45;keyword">public</span> void setPassword(<span class="java&#45;object">String</span> password) &#123; <span class="java&#45;keyword">this</span>.password = password; &#125;&#10;	<span class="java&#45;keyword">public</span> void setRadio(<span class="java&#45;object">String</span> radio) &#123; <span class="java&#45;keyword">this</span>.radio = radio; &#125;&#10;	<span class="java&#45;keyword">public</span> void setSelect(<span class="java&#45;object">String</span> select) &#123; <span class="java&#45;keyword">this</span>.select = select; &#125;&#10;	<span class="java&#45;keyword">public</span> void setTextarea(<span class="java&#45;object">String</span> textarea) &#123; <span class="java&#45;keyword">this</span>.textarea = textarea; &#125;&#10;	<span class="java&#45;keyword">public</span> void setTextfield(<span class="java&#45;object">String</span> textfield) &#123; <span class="java&#45;keyword">this</span>.textfield = textfield; &#125;&#10;	&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> execute() <span class="java&#45;keyword">throws</span> Exception &#123;&#10;		<span class="java&#45;keyword">return</span> SUCCESS;&#10;	&#125;&#10;&#125;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-02-FormProcessingActionvalidation.xml%28sameaslesson4.1.1%29%3A"> FormProcessingAction-validation.xml (same as lesson 4.1.1):</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE validators PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork Validator &#10;1.0//EN&quot;</span>&#160;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;validator&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;validators&gt;</span>&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;checkbox&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please, check the checkbox.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;file&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please select a file.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;password&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please type something in the password field.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;radio&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please select a radio button.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;select&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please select an option from the list.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;textarea&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please type something in the text area.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;&#10;  <span class="xml&#45;tag">&lt;field name=<span class="xml&#45;quote">&quot;textfield&quot;</span>&gt;</span>&#10;    <span class="xml&#45;tag">&lt;field&#45;validator type=<span class="xml&#45;quote">&quot;requiredstring&quot;</span>&gt;</span>&#10;      <span class="xml&#45;tag">&lt;message&gt;</span>Please type something in the text field.<span class="xml&#45;tag">&lt;/message&gt;</span>&#10;    <span class="xml&#45;tag">&lt;/field&#45;validator&gt;</span>&#10;  <span class="xml&#45;tag">&lt;/field&gt;</span>&#10;<span class="xml&#45;tag">&lt;/validators&gt;</span></pre>
+</div></div><br/>
+
+<blockquote class="blockquote"> <a href="TutorialExamples.html" title="TutorialExamples">Try the example!</a></blockquote><p class="paragraph">&#8212;</p>The example above does not use the <tt class="monospaced">#param</tt> tag. So, let&#039;s revisit another example from <a href="TutorialLesson04-01-01.html" title="TutorialLesson04-01-01">lesson 4.1.1</a> - custom components:<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-02-ex03.vm%3A"> ex03.vm:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.2 &#45; Example 3&lt;/title&gt; &#10;&lt;/head&gt; &#10;&#10;&lt;body&gt; &#10;&#10;&lt;p&gt;Custom Component Example:&lt;/p&gt; &#10;&#10;&lt;p&gt; &#10;#bodytag (Component <span class="java&#45;quote">&quot;template=/files/templates/components/datefield.vm&quot;</span>) &#10;	#param (<span class="java&#45;quote">&quot;label&quot;</span>&#160;<span class="java&#45;quote">&quot;Date&quot;</span>) &#10;	#param (<span class="java&#45;quote">&quot;name&quot;</span>&#160;<span class="java&#45;quote">&quot;mydatefield&quot;</span>) &#10;	#param (<span class="java&#45;quote">&quot;size&quot;</span>&#160;<span class="java&#45;quote">&quot;3&quot;</span>) &#10;#end &#10;&lt;/p&gt; &#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-02-%2Ffiles%2Ftemplates%2Fcomponents%2Fdatefield.vm%28sameaslesson4.1.1%29%3A"> /files/templates/components/datefield.vm (same as lesson 4.1.1):</a></h3>
+<div class="code"><div class="codeContent">
+<pre>#set ($name = $tag.params.get(&#039;name&#039;)) &#10;#set ($size = $tag.params.get(&#039;size&#039;)) &#10;#set ($yearSize = $size &#42; 2) &#10;&#10;$tag.params.get(&#039;label&#039;): &#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;$&#123;name&#125;.day&quot;</span> size=<span class="java&#45;quote">&quot;$size&quot;</span> /&gt; / &#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;$&#123;name&#125;.month&quot;</span> size=<span class="java&#45;quote">&quot;$size&quot;</span> /&gt; / &#10;&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;$&#123;name&#125;.year&quot;</span> size=<span class="java&#45;quote">&quot;$yearSize&quot;</span> /&gt; (dd/mm/yyyy)</pre>
+</div></div><p class="paragraph">Notice that, this time, we did not enclose <tt class="monospaced">Date</tt> and <tt class="monospaced">mydatefield</tt> with single quotes, as we had to do when we used the JSP tag.</p><blockquote class="blockquote"> <a href="TutorialExamples.html" title="TutorialExamples">Try the example!</a></blockquote><p class="paragraph"><hr class="line"/></p><a href="TutorialLesson04-01.html" title="TutorialLesson04-01">Previous Lesson</a> | <a href="TutorialLesson04-03.html" title="TutorialLesson04-03">Next Lesson</a><br/>
+
+
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialLesson04-03.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialLesson04-03</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialLesson04-03
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jun 22, 2004 by <font color="#0050B2">dharma</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialLesson04-03-Lesson4.3%3AUsingFreemarkerwithWebWork"> Lesson 4.3: Using Freemarker with WebWork</a></h1></p>Freemarker is a powerfull template engine that competes with Velocity. You can learn more about it in the project&#039;s homepage: <a href="http://freemarker.sourceforge.net" title="Visit page outside Confluence">&#104;ttp://freemarker.sourceforge.net</a>.<p class="paragraph">First of all, to use Freemarker with Webwork, you have to place the freemarker.jar in your <tt class="monospaced">WEB-INF\lib</tt> folder. You can download the distribution <a href="http://freemarker.sourceforge.net/freemarkerdownload.html" title="Visit page outside Confluence">here</a>.</p>After that, just configure <tt class="monospaced">web.xml</tt> and start writing your templates, as explained below.
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-03-web.xml%3A"> web.xml:</a></h3></p>To use Freemarker as the view, you need to modify <tt class="monospaced">web.xml</tt> and add a servlet and a servlet mapping for <tt class="monospaced">FreemarkerServlet</tt>, as demonstrated below:<br/>
+
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;servlet&gt;</span>&#10;	<span class="xml&#45;tag">&lt;servlet&#45;name&gt;</span>freemarker<span class="xml&#45;tag">&lt;/servlet&#45;name&gt;</span>&#10;	<span class="xml&#45;tag">&lt;servlet&#45;class&gt;</span>com.opensymphony.webwork.views.freemarker.FreemarkerServlet<span class="xml&#45;tag">&lt;/servlet&#45;class&gt;</span>&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; FreemarkerServlet settings: &#45;&#45;&gt;</span></span>&#10;		<span class="xml&#45;tag">&lt;init&#45;param&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;name&gt;</span>TemplatePath<span class="xml&#45;tag">&lt;/param&#45;name&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;value&gt;</span>/<span class="xml&#45;tag">&lt;/param&#45;value&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/init&#45;param&gt;</span>&#10;		<span class="xml&#45;tag">&lt;init&#45;param&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;name&gt;</span>NoCache<span class="xml&#45;tag">&lt;/param&#45;name&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;value&gt;</span>true<span class="xml&#45;tag">&lt;/param&#45;value&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/init&#45;param&gt;</span>&#10;		<span class="xml&#45;tag">&lt;init&#45;param&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;name&gt;</span>ContentType<span class="xml&#45;tag">&lt;/param&#45;name&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;value&gt;</span>text/html<span class="xml&#45;tag">&lt;/param&#45;value&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/init&#45;param&gt;</span>&#10;		<span class="xml&#45;tag">&lt;init&#45;param&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;name&gt;</span>default&#95;encoding<span class="xml&#45;tag">&lt;/param&#45;name&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;value&gt;</span>ISO&#45;8859&#45;1<span class="xml&#45;tag">&lt;/param&#45;value&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/init&#45;param&gt;</span>&#10;		<span class="xml&#45;tag">&lt;init&#45;param&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;name&gt;</span>number&#95;format<span class="xml&#45;tag">&lt;/param&#45;name&gt;</span>&#10;			<span class="xml&#45;tag">&lt;param&#45;value&gt;</span>0.##########<span class="xml&#45;tag">&lt;/param&#45;value&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/init&#45;param&gt;</span>&#10;	<span class="xml&#45;tag">&lt;load&#45;on&#45;startup&gt;</span>1<span class="xml&#45;tag">&lt;/load&#45;on&#45;startup&gt;</span>&#10;<span class="xml&#45;tag">&lt;/servlet&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;servlet&#45;mapping&gt;</span> &#10;	<span class="xml&#45;tag">&lt;servlet&#45;name&gt;</span>freemarker<span class="xml&#45;tag">&lt;/servlet&#45;name&gt;</span> &#10;	<span class="xml&#45;tag">&lt;url&#45;pattern&gt;</span>&#42;.ftl<span class="xml&#45;tag">&lt;/url&#45;pattern&gt;</span> &#10;<span class="xml&#45;tag">&lt;/servlet&#45;mapping&gt;</span></pre>
+</div></div><p class="paragraph">The configuration above means that Freemarker templates can be rendered through requests to <tt class="monospaced">.ftl</tt> pages. That also means that you should implement security checks in your templates so an user doesn&#039;t access it directly without going through an action first (if that is required). But you can always place your Freemarker files under WEB-INF so they become unaccessible to direct requests. We will use the latter approach in our examples.</p>Inside a Freemarker template, you will have access to every object managed by WebWork with the following syntax:<br/>
+
+<ul class="star">
+<li> <b class="strong"><tt class="monospaced">$stack</tt></b> = <tt class="monospaced">OgnlValueStack</tt>;</li>
+<li> <b class="strong"><tt class="monospaced">$wwUtil</tt></b> = <tt class="monospaced">FreemarkerUtil</tt>, a toolbox providing services like formatting url, accessing the value stack, etc;</li>
+<li> <b class="strong"><tt class="monospaced">$name-of-property</tt></b> = property retrieved from the value stack. If that fails, it looks up an attribute with that name in the <tt class="monospaced">HttpServletRequest</tt>, <tt class="monospaced">HttpSession</tt> and <tt class="monospaced">ServletContext</tt>, in that order;</li>
+<li> <b class="strong"><tt class="monospaced">$Request</tt></b> = <tt class="monospaced">HttpServletRequest</tt>;</li>
+<li> <b class="strong"><tt class="monospaced">$Session</tt></b> = <tt class="monospaced">HttpServletResponse</tt>;</li>
+<li> <b class="strong"><tt class="monospaced">$Application</tt></b> = <tt class="monospaced">OgnlValueStack</tt>.</li>
+</ul><br/>
+The example below does the same thing as example 2 from <a href="TutorialLesson03.html" title="TutorialLesson03">lesson 3</a>, but now, using Freemarker templates.
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-03-xwork.xml%3A"> xwork.xml:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span> &#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Include webwork defaults (from WebWork&#45;2.1 JAR). &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;include file=<span class="xml&#45;quote">&quot;webwork&#45;default.xml&quot;</span> /&gt;</span>&#10;	&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Configuration for the default package. &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;default&quot;</span> extends=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Default interceptor stack. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;default&#45;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;defaultStack&quot;</span> /&gt;</span> &#10;		&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Action: Lesson 4.3: HelloAction. &#45;&#45;&gt;</span></span>&#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;indexFreemarker&quot;</span> class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.ActionSupport&quot;</span>&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>/WEB&#45;INF/ftl/lesson3/index.ftl<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/action&gt;</span>&#10;&#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;helloFreemarker&quot;</span> class=<span class="xml&#45;quote">&quot;lesson03.HelloAction&quot;</span>&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;error&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>/WEB&#45;INF/ftl/lesson3/index.ftl<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>/WEB&#45;INF/ftl/lesson3/success.ftl<span class="xml&#45;tag">&lt;/result&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/action&gt;</span>&#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson04-03-HelloAction.java%28sameaslesson3%29%3A"> HelloAction.java (same as lesson 3):</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">package</span> lesson03;&#10;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.ActionSupport;&#10;&#10;<span class="java&#45;keyword">public</span> class HelloAction <span class="java&#45;keyword">extends</span> ActionSupport &#123;&#10;	<span class="java&#45;object">String</span> person;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> getPerson() &#123;&#10;		<span class="java&#45;keyword">return</span> person;&#10;	&#125;&#10;	<span class="java&#45;keyword">public</span> void setPerson(<span class="java&#45;object">String</span> person) &#123;&#10;		<span class="java&#45;keyword">this</span>.person = person;&#10;	&#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> execute() <span class="java&#45;keyword">throws</span> Exception &#123;&#10;		<span class="java&#45;keyword">if</span> ((person == <span class="java&#45;keyword">null</span>) || (person.length() == 0)) <span class="java&#45;keyword">return</span> ERROR;&#10;		<span class="java&#45;keyword">else</span>&#160;<span class="java&#45;keyword">return</span> SUCCESS;&#10;	&#125;&#10;&#125;</pre>
+</div></div>
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-03-ex02index.ftl"> ex02-index.ftl</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;#assign ww=JspTaglibs&#91;<span class="java&#45;quote">&quot;/WEB&#45;INF/lib/webwork.tld&quot;</span>&#93; /&gt;&#10;&#10;&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.3 &#45; Example 1&lt;/title&gt;&#10;&lt;/head&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;p&gt;Click &lt;a href=<span class="java&#45;quote">&quot;$&#123;wwUtil.buildUrl(&#039;indexFreemarker.action&#039;)&#125;&quot;</span>&gt;here&lt;/a&gt; to reload <span class="java&#45;keyword">this</span> page.&lt;/p&gt;&#10;&#10;&lt;&#64;ww.form name=<span class="java&#45;quote">&quot;&#039;nameForm&#039;&quot;</span> action=<span class="java&#45;quote">&quot;&#039;helloFreemarker.action&#039;&quot;</span> method=<span class="java&#45;quote">&quot;&#039;POST&#039;&quot;</span>&gt;&#10;	&lt;&#64;ww.textfield label=<span class="java&#45;quote">&quot;&#039;What is your name &#63;&#039;&quot;</span> name=<span class="java&#45;quote">&quot;&#039;person&#039;&quot;</span> value=<span class="java&#45;quote">&quot;person&quot;</span> size=<span class="java&#45;quote">&quot;20&quot;</span>/&gt;&#10;	&lt;&#64;ww.submit name=<span class="java&#45;quote">&quot;&#039;submit&#039;&quot;</span> value=<span class="java&#45;quote">&quot;&#039;Submit&#039;&quot;</span>/&gt;&#10;&lt;/&#64;ww.form&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div></p>If you don&#039;t want to use WebWork&#039;s UI Tags, you could do it like this:<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-03-ex02indexnotags.ftl"> ex02-index-notags.ftl</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.3 &#45; Example 1&lt;/title&gt;&#10;&lt;/head&gt;&#10;&#10;&lt;body&gt;&#10;&#10;&lt;p&gt;Click &lt;a href=<span class="java&#45;quote">&quot;$&#123;wwUtil.buildUrl(&#039;indexFreemarker.action&#039;)&#125;&quot;</span>&gt;here&lt;/a&gt; to reload <span class="java&#45;keyword">this</span> page.&lt;/p&gt;&#10;&#10;&lt;form name=<span class="java&#45;quote">&quot;nameForm&quot;</span> action=<span class="java&#45;quote">&quot;$&#123;wwUtil.buildUrl(&#039;helloFreemarker.action&#039;)&#125;&quot;</span> method=<span class="java&#45;quote">&quot;POST&quot;</span>&gt;&#10;	What is your name &#63; &#10;	&lt;input type=<span class="java&#45;quote">&quot;text&quot;</span> name=<span class="java&#45;quote">&quot;person&quot;</span> value=<span class="java&#45;quote">&quot;$&#123;person&#125;&quot;</span> size=<span class="java&#45;quote">&quot;20&quot;</span>&gt;&#10;	&lt;input type=<span class="java&#45;quote">&quot;submit&quot;</span> name=<span class="java&#45;quote">&quot;submit&quot;</span> value=<span class="java&#45;quote">&quot;Submit&quot;</span>&gt;&#10;&lt;/form&gt;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div></p>However, if you choose no to use tags, it&#039;s recommended that you use Freemarker Macros to write the form elements.
+<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson04-03-ex02success.ftl%3A"> ex02-success.ftl:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;#assign ww=JspTaglibs&#91;<span class="java&#45;quote">&quot;/WEB&#45;INF/lib/webwork.tld&quot;</span>&#93; /&gt;&#10;&#10;&lt;html&gt; &#10;&lt;head&gt; &#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 4.3 &#45; Example 1&lt;/title&gt; &#10;&lt;/head&gt; &#10;&lt;body&gt; &#10;&#10;Come from the property WW tag (taglibs support) : &lt;&#64;ww.property value=<span class="java&#45;quote">&quot;person&quot;</span>/&gt; &lt;br&gt;&#10;Come from the Freemarker lookup in the WW stack : $&#123;person&#125;&#10;&#10;&lt;/body&gt; &#10;&lt;/html&gt;</pre>
+</div></div></p>You can use either WebWork <tt class="monospaced">property</tt> tag or the Freemarker <tt class="monospaced">$person</tt> reference. Both of them return the same thing: a property from the action class.<p class="paragraph"><hr class="line"/></p><a href="TutorialLesson04-02.html" title="TutorialLesson04-02">Previous Lesson</a> | <a href="TutorialLesson05.html" title="TutorialLesson05">Next Lesson</a><br/>
+
+
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialLesson04.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialLesson04</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialLesson04
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on May 31, 2004 by <font color="#0050B2">vitorsouza</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialLesson04-Lesson4%3AViews"> Lesson 4: Views</a></h1></p>There are some different technologies that you could use as the view, i.e., to construct the user interface:
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson04-Lesson4.1JavaServerPages"> Lesson 4.1 - Java Server Pages</a></h2></p>JSP is the common choice, because most Java web developers are already familiar with the technology. This lesson assumes you already have experience with Java Server Pages and demonstrates how you can use the WebWork features in JSP, mostly by using WebWork tags.<p class="paragraph"><a href="TutorialLesson04-01.html" title="TutorialLesson04-01">Go to lesson 4.1</a></p><h2 class="heading2"><a name="TutorialLesson04-Lesson4.2Velocity"> Lesson 4.2 - Velocity</a></h2><p class="paragraph">Velocity is a Java-based template engine that provides a simple, but powerful, template language that replaces JSP and allows for separation of concerns. This lesson assumes that you are already familiar with Velocity and teaches you how to use WebWork features from it.</p><a href="TutorialLesson04-02.html" title="TutorialLesson04-02">Go to lesson 4.2</a>
+<p class="paragraph"><h2 class="heading2"><a name="TutorialLesson04-Lesson4.3Freemarker"> Lesson 4.3 - Freemarker</a></h2></p>Designed for MVC pattern, Freemarker is another Java-based template engine that provides a powerful template language that replaces JSP, but can remain JSP-compatible with a JSP taglib support. This lesson teaches you how to use WebWork and Freemarker together.<p class="paragraph"><a href="TutorialLesson04-03.html" title="TutorialLesson04-03">Go to lesson 4.3</a></p><hr class="line"/><p class="paragraph"><a href="TutorialLesson03.html" title="TutorialLesson03">Previous Lesson</a> | <a href="TutorialLesson05.html" title="TutorialLesson05">Next Lesson</a></p>
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/TutorialLesson05.html

+<html>
+    <head>
+        <title>WebWork 2 : TutorialLesson05</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : TutorialLesson05
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Aug 18, 2004 by <font color="#0050B2">ehauser@www.in.gov</font>.
+				    </div>
+
+				    <p class="paragraph"><h1 style="margin: 4px 0px 4px 0px;" class="heading1"><a name="TutorialLesson05-Lesson5%3AInterceptors"> Lesson 5: Interceptors</a></h1></p>Interceptors allow arbitrary code to be included in the call stack for your action before and/or after processing the action, which can vastly simplify your code itself and provide excellent opportunities for code reuse. Many of the features of XWork and WebWork are implemented as interceptors and can be applied via external configuration along with your own Interceptors in whatever order you specify for any set of actions you define.<p class="paragraph">In other words, when you access a <tt class="monospaced">&#42;.action</tt> URL, WebWork&#039;s <tt class="monospaced">ServletDispatcher</tt> proceeds to the invocation of the an action object. Before it is executed, however, the invocation can be intercepted by another object, that is hence called interceptor. To have an interceptor executed before (or after) a given action, just configure <tt class="monospaced">xwork.xml</tt> properly, like the example below, taken from <a href="TutorialLesson04-01-01.html" title="TutorialLesson04-01-01">lesson 4.1.1</a>:</p><h3 class="heading3"><a name="TutorialLesson05-Interceptorconfigurationfromlesson4.1.1%3A"> Interceptor configuration from lesson 4.1.1:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;formProcessing&quot;</span> class=<span class="xml&#45;quote">&quot;lesson04&#95;01&#95;01.FormProcessingAction&quot;</span>&gt;</span> &#10;	<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;input&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>ex01&#45;index.jsp<span class="xml&#45;tag">&lt;/result&gt;</span> &#10;	<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>ex01&#45;success.jsp<span class="xml&#45;tag">&lt;/result&gt;</span> &#10;	<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;validationWorkflowStack&quot;</span> /&gt;</span> &#10;<span class="xml&#45;tag">&lt;/action&gt;</span></pre>
+</div></div><p class="paragraph">As you can see, lesson 4.1.1&#039;s <tt class="monospaced">formProcessing</tt> Action uses the <tt class="monospaced">validationWorkflowStack</tt>. That is an interceptor stack, which organizes a bunch of interceptors in the order in which they are to be executed. That stack is configured in <tt class="monospaced">webwork-default.xml</tt>, so all we have to do to use it is declare a <tt class="monospaced">&lt;interceptor-ref /&gt;</tt> under the action configuration or a <tt class="monospaced">&lt;default-interceptor-ref /&gt;</tt>, under package configuration, as seen in <a href="TutorialLesson03.html" title="TutorialLesson03">lesson 3</a>&#039;s first example:</p><h3 class="heading3"><a name="TutorialLesson05-Interceptorconfigurationfromlesson3.1%3A"> Interceptor configuration from lesson 3.1:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span> &#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Include webwork defaults (from WebWork&#45;2.1 JAR). &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;include file=<span class="xml&#45;quote">&quot;webwork&#45;default.xml&quot;</span> /&gt;</span>&#10;	&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Configuration for the default package. &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;default&quot;</span> extends=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Default interceptor stack. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;default&#45;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;defaultStack&quot;</span> /&gt;</span> &#10;		&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Action: Lesson 03: HelloWebWorldAction. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;helloWebWorld&quot;</span> class=<span class="xml&#45;quote">&quot;lesson03.HelloWebWorldAction&quot;</span>&gt;</span> &#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;dispatcher&quot;</span>&gt;</span>ex01&#45;success.jsp<span class="xml&#45;tag">&lt;/result&gt;</span> &#10;		<span class="xml&#45;tag">&lt;/action&gt;</span> &#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div><p class="paragraph">But let&#039;s see how it works from scracth:</p><ol>
+<li> Create an interceptor class, which is a class that implements the <tt class="monospaced">com.opensymphony.xwork.interceptor.Interceptor</tt> interface (bundled in <tt class="monospaced">xwork-1.0.jar</tt>);</li>
+<li> Declare the class in your XML configuration file (<tt class="monospaced">xwork.xml</tt>) using the element <tt class="monospaced">&lt;interceptor /&gt;</tt> nested within <tt class="monospaced">&lt;interceptors /&gt;</tt>;</li>
+<li> Create stacks of interceptors, using the <tt class="monospaced">&lt;interceptor-stack /&gt;</tt> element (<em class="emphasis">optional</em>);</li>
+<li> Determine which interceptors are used by which action, using <tt class="monospaced">&lt;interceptor-ref /&gt;</tt> or <tt class="monospaced">&lt;default-interceptor-ref /&gt;</tt>. The former defines the interceptors to be used in a specific action, while the latter determines the default interceptor stack to be used by all actions that do not specify their own <tt class="monospaced">&lt;interceptor-ref /&gt;</tt>.</li>
+</ol><br/>
+Looking inside <tt class="monospaced">webwork-default.xml</tt> we can see how it&#039;s done:<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson05-webworkdefault.xml%3A"> webwork-default.xml:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span> &#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;		<span class="xml&#45;tag">&lt;result&#45;types&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result&#45;type name=<span class="xml&#45;quote">&quot;dispatcher&quot;</span> default=<span class="xml&#45;quote">&quot;true&quot;</span>&#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.webwork.dispatcher.ServletDispatcherResult&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result&#45;type name=<span class="xml&#45;quote">&quot;redirect&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.webwork.dispatcher.ServletRedirectResult&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result&#45;type name=<span class="xml&#45;quote">&quot;velocity&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.webwork.dispatcher.VelocityResult&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result&#45;type name=<span class="xml&#45;quote">&quot;chain&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.ActionChainResult&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;result&#45;type name=<span class="xml&#45;quote">&quot;xslt&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.webwork.views.xslt.XSLTResult&quot;</span>/&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/result&#45;types&gt;</span>&#10;	&#10;		<span class="xml&#45;tag">&lt;interceptors&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;timer&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.interceptor.TimerInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;logger&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.interceptor.LoggingInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;chain&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.interceptor.ChainingInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;static&#45;params&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.interceptor.StaticParametersInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;params&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.interceptor.ParametersInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;model&#45;driven&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.interceptor.ModelDrivenInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;component&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.interceptor.component.ComponentInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;token&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.webwork.interceptor.TokenInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;token&#45;session&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.webwork.interceptor.TokenSessionStoreInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;validation&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.validator.ValidationInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;workflow&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;servlet&#45;config&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.webwork.interceptor.ServletConfigInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;prepare&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.xwork.interceptor.PrepareInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;conversionError&quot;</span> &#10;				class=<span class="xml&#45;quote">&quot;com.opensymphony.webwork.interceptor.WebWorkConversionErrorInterceptor&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor&#45;stack name=<span class="xml&#45;quote">&quot;defaultStack&quot;</span>&gt;</span>&#10;				<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;static&#45;params&quot;</span>/&gt;</span>&#10;				<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;params&quot;</span>/&gt;</span>&#10;				<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;conversionError&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;/interceptor&#45;stack&gt;</span>&#10;			<span class="xml&#45;tag">&lt;interceptor&#45;stack name=<span class="xml&#45;quote">&quot;validationWorkflowStack&quot;</span>&gt;</span>&#10;				<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;defaultStack&quot;</span>/&gt;</span>&#10;				<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;validation&quot;</span>/&gt;</span>&#10;				<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;workflow&quot;</span>/&gt;</span>&#10;			<span class="xml&#45;tag">&lt;/interceptor&#45;stack&gt;</span>&#10;		<span class="xml&#45;tag">&lt;/interceptors&gt;</span>&#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div></p>Since we included <tt class="monospaced">webwork-default.xml</tt> in our <tt class="monospaced">xwork.xml</tt>, all the interceptors and stacks above are available for us to use in our actions. Here&#039;s what these interceptors do:<br/>
+
+<ul class="star">
+<li> <b class="strong">timer</b>: clocks how long the action (including nested interceptors and view) takes to execute;</li>
+<li> <b class="strong">logger</b>: logs the action being executed;</li>
+<li> <b class="strong">chain</b>: makes the previous action&#039;s properties available to the current action. Used to make action chaining (reference: <a href="Result Types.html" title="Result Types">Result Types</a>);</li>
+<li> <b class="strong">static-params</b>: sets the parameters defined in <tt class="monospaced">xwork.xml</tt> onto the action. These are the <tt class="monospaced">&lt;param /&gt;</tt> tags that are direct children of the <tt class="monospaced">&lt;action /&gt;</tt> tag;</li>
+<li> <b class="strong">params</b>: sets the request (POST and GET) parameters onto the action class. We have seen an example of this in <a href="TutorialLesson03.html" title="TutorialLesson03">lesson 3</a>;</li>
+<li> <b class="strong">model-driven</b>: if the action implements <tt class="monospaced">ModelDriven</tt>, pushes the <tt class="monospaced">getModel()</tt> result onto the Value Stack;</li>
+<li> <b class="strong">component</b>: enables and makes registered components available to the actions. (reference: <span class="error">&#91;IoC &amp; Components&#93;</span>);</li>
+<li> <b class="strong">token</b>: checks for valid token presence in action, prevents duplicate form submission;</li>
+<li> <b class="strong">token-session</b>: same as above, but storing the submitted data in session when handed an invalid token;</li>
+<li> <b class="strong">validation</b>: performs validation using the validators defined in <tt class="monospaced">&#123;Action&#125;-validation.xml</tt> (reference: <a href="Validation.html" title="Validation">Validation</a>). We&#039;ve seen an example of this in <a href="TutorialLesson04-01-01.html" title="TutorialLesson04-01-01">lesson 4.1.1</a>;</li>
+<li> <b class="strong">workflow</b>: calls the validate method in your action class. If action errors created then it returns the <tt class="monospaced">INPUT</tt> view. Good to use together with the validation interceptor (reference: <a href="Validation.html" title="Validation">Validation</a>);</li>
+<li> <b class="strong">servlet-config</b>: give access to <tt class="monospaced">HttpServletRequest</tt> and <tt class="monospaced">HttpServletResponse</tt> (think twice before using this since this ties you to the Servlet API);</li>
+<li> <b class="strong">prepare</b>: allows you to programmatic access to your Action class before the parameters are set on it.;</li>
+<li> <b class="strong">conversionError</b>: <font color="red"><em class="emphasis">help needed here</em></font>.</li>
+</ul><p class="paragraph"><h2 class="heading2"><a name="TutorialLesson05-BuildingyourownInterceptor"> Building your own Interceptor</a></h2></p>If none of the above interceptors suit your particular need, you will have to implement your own interceptor. Fortunately, this is an easy task to accomplish. Suppose we need an interceptor that places a greeting in the Session according to the time of the day (morning, afternoon or evening). Here&#039;s how we could implement it:<p class="paragraph"><h3 class="heading3"><a name="TutorialLesson05-GreetingInterceptor.java%3A"> GreetingInterceptor.java:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">package</span> lesson05;&#10;&#10;<span class="java&#45;keyword">import</span> java.util.Calendar;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.interceptor.Interceptor;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.ActionInvocation;&#10;&#10;<span class="java&#45;keyword">public</span> class GreetingInterceptor <span class="java&#45;keyword">implements</span> Interceptor &#123;&#10;	<span class="java&#45;keyword">public</span> void init() &#123; &#125;&#10;	<span class="java&#45;keyword">public</span> void destroy() &#123; &#125;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> intercept(ActionInvocation invocation) <span class="java&#45;keyword">throws</span> Exception &#123;&#10;		Calendar calendar = Calendar.getInstance();&#10;		<span class="java&#45;object">int</span> hour = calendar.get(Calendar.HOUR&#95;OF&#95;DAY);&#10;		<span class="java&#45;object">String</span> greeting = (hour &lt; 6) &#63; <span class="java&#45;quote">&quot;Good evening&quot;</span> : &#10;			((hour &lt; 12) &#63; <span class="java&#45;quote">&quot;Good morning&quot;</span>: &#10;			((hour &lt; 18) &#63; <span class="java&#45;quote">&quot;Good afternoon&quot;</span>: <span class="java&#45;quote">&quot;Good evening&quot;</span>));&#10;&#10;		invocation.getInvocationContext().getSession().put(<span class="java&#45;quote">&quot;greeting&quot;</span>, greeting);&#10;&#10;		<span class="java&#45;object">String</span> result = invocation.invoke();&#10;&#10;		<span class="java&#45;keyword">return</span> result;&#10;	&#125;&#10;&#125;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson05-xwork.xml%3A"> xwork.xml:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="xml&#45;tag">&lt;&#33;DOCTYPE xwork PUBLIC <span class="xml&#45;quote">&quot;&#45;//OpenSymphony Group//XWork 1.0//EN&quot;</span> &#10;<span class="xml&#45;quote">&quot;&#104;ttp://www.opensymphony.com/xwork/xwork&#45;1.0.dtd&quot;</span>&gt;</span>&#10;&#10;<span class="xml&#45;tag">&lt;xwork&gt;</span>&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Include webwork defaults (from WebWork&#45;2.1 JAR). &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;include file=<span class="xml&#45;quote">&quot;webwork&#45;default.xml&quot;</span> /&gt;</span>&#10;	&#10;	<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Configuration for the default package. &#45;&#45;&gt;</span></span>&#10;	<span class="xml&#45;tag">&lt;package name=<span class="xml&#45;quote">&quot;default&quot;</span> extends=<span class="xml&#45;quote">&quot;webwork&#45;default&quot;</span>&gt;</span>&#10;		<span class="xml&#45;tag">&lt;interceptors&gt;</span> &#10;			<span class="xml&#45;tag">&lt;interceptor name=<span class="xml&#45;quote">&quot;greeting&quot;</span> class=<span class="xml&#45;quote">&quot;section02.lesson05.GreetingInterceptor&quot;</span> /&gt;</span> &#10;		<span class="xml&#45;tag">&lt;/interceptors&gt;</span> &#10;		&#10;		<span class="xml&#45;tag"><span class="xml&#45;comment">&lt;&#33;&#45;&#45; Action: Lesson 5: GreetingInterceptor. &#45;&#45;&gt;</span></span> &#10;		<span class="xml&#45;tag">&lt;action name=<span class="xml&#45;quote">&quot;greetingAction&quot;</span> class=<span class="xml&#45;quote">&quot;lesson05.GreetingAction&quot;</span>&gt;</span> &#10;			<span class="xml&#45;tag">&lt;result name=<span class="xml&#45;quote">&quot;success&quot;</span> type=<span class="xml&#45;quote">&quot;velocity&quot;</span>&gt;</span>ex01&#45;result.vm<span class="xml&#45;tag">&lt;/result&gt;</span> &#10;			<span class="xml&#45;tag">&lt;interceptor&#45;ref name=<span class="xml&#45;quote">&quot;greeting&quot;</span> /&gt;</span> &#10;		<span class="xml&#45;tag">&lt;/action&gt;</span> &#10;	<span class="xml&#45;tag">&lt;/package&gt;</span>&#10;<span class="xml&#45;tag">&lt;/xwork&gt;</span></pre>
+</div></div><p class="paragraph"><h3 class="heading3"><a name="TutorialLesson05-GreetingAction.java%3A"> GreetingAction.java:</a></h3>
+<div class="code"><div class="codeContent">
+<pre><span class="java&#45;keyword">package</span> lesson05;&#10;&#10;<span class="java&#45;keyword">import</span> com.opensymphony.xwork.ActionSupport;&#10;&#10;<span class="java&#45;keyword">public</span> class GreetingAction <span class="java&#45;keyword">extends</span> ActionSupport &#123;&#10;	<span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> execute() <span class="java&#45;keyword">throws</span> Exception &#123;&#10;		<span class="java&#45;keyword">return</span> SUCCESS;&#10;	&#125;&#10;&#125;</pre>
+</div></div></p><h3 class="heading3"><a name="TutorialLesson05-ex01result.vm%3A"> ex01-result.vm:</a></h3>
+<div class="code"><div class="codeContent">
+<pre>&lt;html&gt;&#10;&lt;head&gt;&#10;&lt;title&gt;WebWork Tutorial &#45; Lesson 5 &#45; Example 1&lt;/title&gt;&#10;&lt;/head&gt;&#10;&lt;body&gt;&#10;&#10;#set ($ses = $req.getSession())&#10;&lt;p&gt;&lt;b&gt;$&#123;ses.getAttribute(&#039;greeting&#039;)&#125;&#33;&lt;/b&gt;&lt;/p&gt;&#10;&#10;&lt;/body&gt;&#10;&lt;/html&gt;</pre>
+</div></div><p class="paragraph">Let&#039;s take a look at our interceptor class first. As explained before, the interceptor must implement <tt class="monospaced">com.opensymphony.xwork.interceptor.Interceptor</tt>&#039;s methods: <tt class="monospaced">init()</tt>, called during interceptor initialization, <tt class="monospaced">destroy()</tt>, called during destruction, and most importantly, <tt class="monospaced">intercept(ActionInvocation invocation)</tt>, which is where we place the code that does the work.</p>Notice that our interceptor returns the result from <tt class="monospaced">invocation.invoke()</tt> which is the method responsible for executing the next interceptor in the stack or, if this is the last one, the action. This means that the interceptor has the power of short-circuiting the action invocation and return a result string without executing the action at all! Use this with caution, though.<p class="paragraph">One other thing that interceptors can do is execute code after the action has executed. To do that, just place code after the invocation.invoke() call. WebWork provides an abstract class that already implements this kind of behaviour: <tt class="monospaced">com.opensymphony.xwork.interceptor.AroundInterceptor</tt>. Just extend it and implement the methods <tt class="monospaced">before(ActionInvocation invocation)</tt> and <tt class="monospaced">after(ActionInvocation dispatcher, String result)</tt>.</p>The <tt class="monospaced">xwork.xml</tt> configuration, the action class and the result page are pretty straightforward and require no further explanation.<br/>
+
+<blockquote class="blockquote"> <a href="TutorialExamples.html" title="TutorialExamples">Try the example!</a></blockquote>
+<p class="paragraph"><hr class="line"/></p><a href="TutorialLesson04.html" title="TutorialLesson04">Previous Lesson</a> | <a href="TutorialEnd.html" title="TutorialEnd">End of Tutorial</a><br/>
+
+
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/Type Conversion.html

+<html>
+    <head>
+        <title>WebWork 2 : Type Conversion</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : Type Conversion
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Jul 19, 2004 by <font color="#0050B2">unkyaku</font>.
+				    </div>
+
+				    <p class="paragraph">WebWork has very advanced type conversion support thanks to XWork.  For more details please consult <a href="http://wiki.opensymphony.com//display/XW/Type+Conversion" title="Type Conversion">XW:Type Conversion</a>.</p><h2 class="heading2"><a name="TypeConversion-ASimpleExample"> A Simple Example</a></h2><p class="paragraph">Type conversion is great for situations where you need to turn a String in to a more complex object. Because the web is type-agnostic (everything is a String in HTTP), WebWork&#039;s type conversion features are very useful. For instance, if you were prompting a user to enter in coordinates in the form of a String (&quot;3, 22&quot;), you could have WebWork do the conversion both from String to Point and from Point to String.</p>Using this &quot;point&quot; example, if your action (or another compound object in which you are setting properties on) has a corresponding className-conversion.properties file, WebWork will use the configured type converters for conversion to and from strings. So turning &quot;3, 22&quot; in to new Point(3, 22) is done by merely adding the following entry to ClassName-conversion.properties:<br/>
+
+<div class="code"><div class="codeContent">
+<pre>point = com.acme.PointConverter&#10;# note: PointerConverter must implement ognl.TypeConverter &#10;#          or extend ognl.DefaultTypeConverter</pre>
+</div></div><p class="paragraph">Your type converter should be sure to check what class type it is being requested to convert. Because it is used for both to and from strings, you will need to split the conversion method in to two parts: one that turns Strings in to Points, and one that turns Points in to Strings.</p>After this is done, you can now reference your point (&lt;ww:property value=&quot;point&quot;/&gt;) and it will be printed as &quot;3, 22&quot; again. As such, if you submit this back to an action, it will be converted back to a Point once again.<p class="paragraph">NOTE: Type conversion should not be used as a substitute for i18n. It is not recommended to use this feature to print out properly formatted dates. Rather, you should use the i18n features of WebWork (and consult the JavaDocs for JDK&#039;s MessageFormat object) to see how a properly formatted date should be displayed.</p>
+
+				    
+                    			    </td>
+		    </tr>
+	    </table>
+	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+		    <tr>
+			    <td align="center"><font color="grey">Document generated by Confluence on Aug 27, 2004 11:46</font></td>
+		    </tr>
+	    </table>
+    </body>
+</html>

File docs/wikidocs/UI Tags.html

+<html>
+    <head>
+        <title>WebWork 2 : UI Tags</title>
+	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
+    </head>
+
+    <body>
+	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+		    <tr>
+			    <td valign="top" class="pagebody">
+				    <div class="pageheader">
+					    <span class="pagetitle">
+                            WebWork 2 : UI Tags
+                                                    </span>
+				    </div>
+				    <div class="pagesubheading">
+					    This page last changed on Aug 05, 2004 by <font color="#0050B2">plightbo</font>.
+				    </div>
+
+				    <p class="paragraph"><h2 style="margin: 4px 0px 4px 0px;" class="heading2"><a name="UITags-WebWork2UITags%3Caname%3D%22UITagstop%22%3E%3C%2Fa%3E"> WebWork 2 UI Tags <a name="UITags-top"></a></a></h2></p>Click on a tag to find more information on the tag.  Note that all UI tags are now evaluated against the value stack so you need to (single) quote your literal string values.<p class="paragraph">The actual rendering of these tags can be customized.  The location of the tag templates is defined by the webwork.ui.theme property in webwork.properties. See the <a href="Themes.html" title="Themes">Themes</a> reference for more details.</p><table class="wikitable">
+<tr>
+<th> Tag Name 		</th><th> Description </th>
+</tr><tr>
+<td> <a href="#UITags-checkbox" title="checkbox on UI Tags">&lt;ww:checkbox /&gt;</a> 		</td><td> render a checkbox input field </td>
+</tr><tr>
+<td> <a href="#UITags-checkboxlist" title="checkboxlist on UI Tags">&lt;ww:checkboxlist /&gt;</a> 		</td><td> render a list of checkboxes  </td>
+</tr><tr>
+<td> <a href="#UITags-combobox" title="combobox on UI Tags">&lt;ww:combobox /&gt;</a> 		</td><td> Widget that fills a text box from a select  </td>
+</tr><tr>
+<td> <a href="#UITags-component" title="component on UI Tags">&lt;ww:component /&gt;</a>		</td><td> render a custom ui widget </td>
+</tr><tr>
+<td> <a href="#UITags-file" title="file on UI Tags">&lt;ww:file /&gt;</a>			</td><td> renders a file select input field </td>
+</tr><tr>
+<td> <a href="#UITags-form" title="form on UI Tags">&lt;ww:form /&gt;</a>			</td><td> defines an input form </td>
+</tr><tr>
+<td> <a href="#UITags-hidden" title="hidden on UI Tags">&lt;ww:hidden /&gt;</a>			</td><td> render a hidden field </td>
+</tr><tr>
+<td> <a href="#UITags-label" title="label on UI Tags">&lt;ww:label /&gt;</a>			</td><td> render a label that displays read-only information </td>
+</tr><tr>
+<td> <a href="#UITags-password" title="password on UI Tags">&lt;ww:password /&gt;</a>		</td><td> render a password input field </td>
+</tr><tr>
+<td> <a href="#UITags-radio" title="radio on UI Tags">&lt;ww:radio /&gt;</a>			</td><td> renders a radio button input field </td>
+</tr><tr>
+<td> <a href="#UITags-select" title="select on UI Tags">&lt;ww:select /&gt;</a>			</td><td> renders a select element </td>
+</tr><tr>
+<td> <a href="#UITags-submit" title="submit on UI Tags">&lt;ww:submit /&gt;</a>			</td><td> renders a submit button </td>
+</tr><tr>
+<td> <a href="#UITags-table" title="table on UI Tags">&lt;ww:table /&gt;</a>				</td><td> renders a table </td>
+</tr><tr>
+<td> <a href="#UITags-tabbedpane" title="tabbedpane on UI Tags">&lt;ww:tabbedpane /&gt;</a>		</td><td> renders a tabbedpane </td>
+</tr><tr>
+<td> <a href="#UITags-textarea" title="textarea on UI Tags">&lt;ww:textarea /&gt;</a>		</td><td> renders a text area input field </td>
+</tr><tr>
+<td> <a href="#UITags-textfield" title="textfield on UI Tags">&lt;ww:textfield /&gt;</a>		</td><td> renders an input field of type text </td>
+</tr><tr>
+<td> <a href="#UITags-token" title="token on UI Tags">&lt;ww:token /&gt;</a>		</td><td> Stop double-submission of forms </td>
+</tr><tr>
+<th>Internationalization Tags</th><th> </th>
+</tr><tr>
+<td> <a href="#UITags-i18n" title="i18n on UI Tags">&lt;ww:i18n /&gt;</a>				</td><td> put resource bundle in stack </td>
+</tr><tr>
+<td> <a href="#UITags-text" title="text on UI Tags">&lt;ww:text /&gt;</a>				</td><td> renders string from bundle </td>
+</tr>
+</table><br/>
+(<a href="#top" title="Visit page outside Confluence">back to the top</a>)
+<h3 class="heading3"><a name="UITags-%3Cfontcolor%3D%22blue%22%3E%26lt%3Bww%3Acheckbox%2F%26gt%3B%3C%2Ffont%3E%3Caname%3D%22UITagscheckbox%22%3E%3C%2Fa%3E"><font color="blue"><b class="strong">&lt;ww:checkbox /&gt;</b></font>&#160;<a name="UITags-checkbox"></a> </a></h3><p class="paragraph">Renders an HTML &lt;input&gt; element of type checkbox, populated by the specified property from the OgnlValueStack.</p><b class="strong">Sample Usages</b>
+<div class="code"><div class="codeContent">
+<pre>JSP&#10;    &lt;ww:checkbox label=<span class="java&#45;quote">&quot;&#039;checkbox test&#039;&quot;</span> name=<span class="java&#45;quote">&quot;&#039;checkboxField1&#039;&quot;</span> value=<span class="java&#45;quote">&quot;aBoolean&quot;</span> fieldValue=<span class="java&#45;quote">&quot;&#039;<span class="java&#45;keyword">true</span>&#039;&quot;</span>/&gt;&#10;&#10;Velocity&#10;    #tag( Checkbox <span class="java&#45;quote">&quot;label=&#039;checkbox test&#039;&quot;</span>&#160;<span class="java&#45;quote">&quot;name=&#039;checkboxField1&#039;&quot;</span> value=<span class="java&#45;quote">&quot;aBoolean&quot;</span> fieldValue=<span class="java&#45;quote">&quot;&#039;<span class="java&#45;keyword">true</span>&#039;&quot;</span> )&#10;&#10;HTML (simple template, aBoolean == <span class="java&#45;keyword">true</span>)&#10;	&lt;input type=<span class="java&#45;quote">&quot;checkbox&quot;</span> name=<span class="java&#45;quote">&quot;checkboxField1&quot;</span> value=<span class="java&#45;quote">&quot;<span class="java&#45;keyword">true</span>&quot;</span> checked=<span class="java&#45;quote">&quot;<span class="java&#45;keyword">true</span>&quot;</span> /&gt;</pre>
+</div></div><p class="paragraph"><b class="strong">Attributes</b>
+<table class="wikitable">
+<tr>
+<th>	Name			</th><th>	Required	</th><th>	Description	</th>
+</tr><tr>
+<td>	id				</td><td>	no			</td><td>	HTML id attribute	</td>
+</tr><tr>
+<td>	name 			</td><td>	<b class="strong">yes</b>		</td><td>	HTML name attribute	</td>
+</tr><tr>
+<td>	label			</td><td>	no			</td><td>	Text used as label in template	</td>
+</tr><tr>
+<td>	labelposition	</td><td>	no			</td><td>	Alignment of label (left,right,center)	</td>
+</tr><tr>
+<td>	required		</td><td>	no			</td><td>	Is field required for form submission	</td>
+</tr><tr>
+<td>	value			</td><td>	no			</td><td>	Boolean which if true adds &quot;checked=true&quot; to tag	</td>
+</tr><tr>
+<td>	fieldValue		</td><td>	<b class="strong">yes</b>		</td><td>	the actual HTML value attribute of the checkbox	</td>
+</tr><tr>
+<td>	tabindex		</td><td>	no			</td><td>	HTML tabindex attribute	</td>
+</tr><tr>
+<td>	onchange		</td><td>	no			</td><td>	HTML onchange attribute	</td>
+</tr><tr>
+<td>	cssClass		</td><td>	no			</td><td>	HTML class attribute	</td>
+</tr><tr>
+<td>	cssStyle		</td><td>	no			</td><td>	HTML style attribute	</td>
+</tr><tr>
+<td>	theme			</td><td>	no			</td><td>	Theme to use	</td>
+</tr><tr>
+<td>	template		</td><td>	no			</td><td>	Name of template to use	</td>
+</tr>
+</table><br/>
+(<a href="#top" title="Visit page outside Confluence">back to the top</a>)
+<h3 class="heading3"><a name="UITags-%3Cfontcolor%3D%22blue%22%3E%26lt%3Bww%3Acheckboxlist%2F%26gt%3B%3C%2Ffont%3E%3Caname%3D%22UITagscheckboxlist%22%3E%3C%2Fa%3E"><font color="blue"><b class="strong">&lt;ww:checkboxlist /&gt;</b></font>&#160;<a name="UITags-checkboxlist"></a> </a></h3></p>Creates a series of checkboxes from a list. Setup is like &lt;ww:select /&gt; or &lt;ww:radio /&gt;, but creates checkbox tags.<p class="paragraph"><b class="strong">Attributes</b>
+<table class="wikitable">
+<tr>
+<th>	Name			</th><th>	Required	</th><th>	Description	</th>
+</tr><tr>