Source

webwork / docs / wikidocs / Global results.html

<html>
    <head>
        <title>WebWork 2 : Global results</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 : Global results
                                                    </span>
				    </div>
				    <div class="pagesubheading">
					    This page last changed on Jun 16, 2004 by <font color="#0050B2">casey</font>.
				    </div>

				    <p class="paragraph">Global results allows you to define result mappings which will be used as defaults for all action configurations and will be automatically inherited by all action configurations in this package and all packages which extend this package.  In other words, if you have the same result specified within multiple actions, then you can define it as a global result.
<h5 class="heading5"><a name="Globalresults-globalresultsexample"> global results example</a></h5>
<div class="code"><div class="codeContent">
<pre>&lt;<span class="java&#45;keyword">package</span> name=<span class="java&#45;quote">&quot;<span class="java&#45;keyword">default</span>&quot;</span>&gt;&#10;....&#10;&lt;global&#45;results&gt; &#10;    &lt;result name=<span class="java&#45;quote">&quot;login&quot;</span> type=<span class="java&#45;quote">&quot;dispatcher&quot;</span>&gt; &#10;        &lt;param name=<span class="java&#45;quote">&quot;location&quot;</span>&gt;login.jsp&lt;/param&gt; &#10;    &lt;/result&gt; &#10;&lt;/global&#45;results&gt; &#10;&lt;action name=<span class="java&#45;quote">&quot;foo&quot;</span>  class=<span class="java&#45;quote">&quot;mypackage.fooAction&quot;</span>&gt;&#10;    &lt;result name=<span class="java&#45;quote">&quot;success&quot;</span> type=<span class="java&#45;quote">&quot;dispatcher&quot;</span>&gt;bar.jsp&lt;/result&gt; &#10;&lt;/action&gt;&#10;&lt;action name=<span class="java&#45;quote">&quot;submitForm&quot;</span>  class=<span class="java&#45;quote">&quot;mypackage.submitFormAction&quot;</span>&gt;&#10;    &lt;result name=<span class="java&#45;quote">&quot;success&quot;</span> type=<span class="java&#45;quote">&quot;dispatcher&quot;</span>&gt;submitSuccess.jsp&lt;/result&gt; &#10;&lt;/action&gt;&#10;...&#10;&lt;/<span class="java&#45;keyword">package</span>&gt;</pre>
</div></div><br/>
Same thing
<div class="code"><div class="codeContent">
<pre>&lt;<span class="java&#45;keyword">package</span> name=<span class="java&#45;quote">&quot;<span class="java&#45;keyword">default</span>&quot;</span>&gt;&#10;....&#10;&lt;action name=<span class="java&#45;quote">&quot;foo&quot;</span>  class=<span class="java&#45;quote">&quot;mypackage.fooAction&quot;</span>&gt;&#10;    &lt;result name=<span class="java&#45;quote">&quot;success&quot;</span> type=<span class="java&#45;quote">&quot;dispatcher&quot;</span>&gt;bar.jsp&lt;/result&gt; &#10;    &lt;result name=<span class="java&#45;quote">&quot;login&quot;</span> type=<span class="java&#45;quote">&quot;dispatcher&quot;</span>&gt;login.jsp&lt;/result&gt; &#10;&lt;/action&gt;&#10;&lt;action name=<span class="java&#45;quote">&quot;submitForm&quot;</span>  class=<span class="java&#45;quote">&quot;mypackage.submitFormAction&quot;</span>&gt;&#10;    &lt;result name=<span class="java&#45;quote">&quot;success&quot;</span> type=<span class="java&#45;quote">&quot;dispatcher&quot;</span>&gt;submitSuccess.jsp&lt;/result&gt;&#10;    &lt;result name=<span class="java&#45;quote">&quot;login&quot;</span> type=<span class="java&#45;quote">&quot;dispatcher&quot;</span>&gt;login.jsp&lt;/result&gt;  &#10;&lt;/action&gt;&#10;...&#10;&lt;/<span class="java&#45;keyword">package</span>&gt;</pre>
</div></div></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 Oct 18, 2004 00:08</font></td>
		    </tr>
	    </table>
    </body>
</html>