1. opensymphony
  2. xwork


xwork / docs / wikidocs / Basics.html

        <title>XWork : Basics</title>
	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    

	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
			    <td valign="top" class="pagebody">
				    <div class="pageheader">
					    <span class="pagetitle">
                            XWork : Basics
				    <div class="pagesubheading">
					    This page last changed on Jun 03, 2004 by <font color="#0050B2">unkyaku</font>.

				    <p class="paragraph"><h2 style="margin: 4px 0px 4px 0px;" class="heading2"><a name="Basics-Actions"> Actions</a></h2></p>Actions are the basic unit of execution&#8230;<p class="paragraph"><h3 class="heading3"><a name="Basics-TheActionInterface"> The Action Interface</a></h3></p>The basic interface which all XWork actions must implement. It provides several standard return values like SUCCESS and INPUT, and only contains one method:<br/>

<div class="code"><div class="codeContent">
<pre><span class="java&#45;keyword">public</span>&#160;<span class="java&#45;object">String</span> execute() <span class="java&#45;keyword">throws</span> Exception;</pre>
</div></div><p class="paragraph">In general, Actions should simply extend ActionSupport, which provides a default implementation for the most common actions.</p><h2 class="heading2"><a name="Basics-ActionContext"> ActionContext</a></h2><p class="paragraph">The ActionContext provides access to the execution environment in the form of named objects during an Action invocation. A new ActionContext is created for each invocation allowing developers to access/modify these properties in a thread safe manner. The ActionContext makes a number of properties available that are typically set to appropriate values by the framework. In WebWork 2 for example, the ActionContext session map wraps an underlying HttpSession object. This allows access to environment specific properties without tying the core framework to a specific execution environment.</p>The ActionContext is acquired through the static ActionContext.getContext() method. The ActionContext is a thread local variable and thus the properties of the ActionContext will be relative to the current request thread. The ActionContext has several methods for commonly used properties as well as get() and set() methods which can be used for application specific properties. <br/>

	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
			    <td align="center"><font color="grey">Document generated by Confluence on Sep 07, 2004 00:34</font></td>