com.opensymphony.webwork.views.tiles
Class TilesResult

java.lang.Object
  extended by com.opensymphony.webwork.dispatcher.WebWorkResultSupport
      extended by com.opensymphony.webwork.dispatcher.ServletDispatcherResult
          extended by com.opensymphony.webwork.views.tiles.TilesResult
All Implemented Interfaces:
WebWorkStatics, Result, Serializable

public class TilesResult
extends ServletDispatcherResult

Renders a view using struts-tiles. In your web.xml file, you need to add a servlet entry for TilesServlet to load the tiles definitions into the ServletContext. tiles org.apache.tiles.servlets.TilesServlet definitions-config /WEB-INF/tiles-config.xml 1 In xwork.xml, use type="tiles" on your . userForm userList Making this result type the default for the current package.

Version:
$Id: TilesResult.java 2207 2006-02-17 19:06:03Z rainerh $
Author:
Matt Raible, Rainer Hermanns
See Also:
Serialized Form

Field Summary
protected  ActionInvocation invocation
           
 
Fields inherited from class com.opensymphony.webwork.dispatcher.WebWorkResultSupport
DEFAULT_PARAM, encode, location, parse
 
Fields inherited from interface com.opensymphony.webwork.WebWorkStatics
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER
 
Constructor Summary
TilesResult()
           
 
Method Summary
protected  Locale deduceLocale(HttpServletRequest request)
           
 void doExecute(String location, ActionInvocation invocation)
          Dispatches to the given location.
protected  void executeController(org.apache.struts.tiles.Controller controller, org.apache.struts.tiles.ComponentContext context, HttpServletRequest request, HttpServletResponse response)
          Execute the given Tiles controller.
protected  org.apache.struts.tiles.ComponentContext getComponentContext(org.apache.struts.tiles.ComponentDefinition definition, HttpServletRequest request)
          Determine the Tiles component context for the given Tiles definition.
protected  org.apache.struts.tiles.ComponentDefinition getComponentDefinition(org.apache.struts.tiles.DefinitionsFactory factory, HttpServletRequest request)
          Determine the Tiles component definition for the given Tiles definitions factory.
protected  org.apache.struts.tiles.Controller getController(org.apache.struts.tiles.ComponentDefinition definition, HttpServletRequest request)
          Determine and initialize the Tiles component controller for the given Tiles definition, if any.
protected  String getDispatcherPath(org.apache.struts.tiles.ComponentDefinition definition, HttpServletRequest request)
          Determine the dispatcher path for the given Tiles definition, i.e.
 
Methods inherited from class com.opensymphony.webwork.dispatcher.WebWorkResultSupport
conditionalParse, execute, setEncode, setLocation, setParse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

invocation

protected ActionInvocation invocation
Constructor Detail

TilesResult

public TilesResult()
Method Detail

doExecute

public void doExecute(String location,
                      ActionInvocation invocation)
               throws Exception
Dispatches to the given location. Does its forward via a RequestDispatcher. If the dispatch fails a 404 error will be sent back in the http response.

Overrides:
doExecute in class ServletDispatcherResult
Parameters:
location - the location to dispatch to.
invocation - the execution state of the action
Throws:
Exception - if an error occurs. If the dispatch fails the error will go back via the HTTP request.

deduceLocale

protected Locale deduceLocale(HttpServletRequest request)

getComponentDefinition

protected org.apache.struts.tiles.ComponentDefinition getComponentDefinition(org.apache.struts.tiles.DefinitionsFactory factory,
                                                                             HttpServletRequest request)
                                                                      throws Exception
Determine the Tiles component definition for the given Tiles definitions factory.

Parameters:
factory - the Tiles definitions factory
request - current HTTP request
Returns:
the component definition
Throws:
Exception

getComponentContext

protected org.apache.struts.tiles.ComponentContext getComponentContext(org.apache.struts.tiles.ComponentDefinition definition,
                                                                       HttpServletRequest request)
                                                                throws Exception
Determine the Tiles component context for the given Tiles definition.

Parameters:
definition - the Tiles definition to render
request - current HTTP request
Returns:
the component context
Throws:
Exception - if preparations failed

getController

protected org.apache.struts.tiles.Controller getController(org.apache.struts.tiles.ComponentDefinition definition,
                                                           HttpServletRequest request)
                                                    throws Exception
Determine and initialize the Tiles component controller for the given Tiles definition, if any.

Parameters:
definition - the Tiles definition to render
request - current HTTP request
Returns:
the component controller to execute, or null if none
Throws:
Exception - if preparations failed

executeController

protected void executeController(org.apache.struts.tiles.Controller controller,
                                 org.apache.struts.tiles.ComponentContext context,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
                          throws Exception
Execute the given Tiles controller.

Parameters:
controller - the component controller to execute
context - the component context
request - current HTTP request
response - current HTTP response
Throws:
Exception - if controller execution failed

getDispatcherPath

protected String getDispatcherPath(org.apache.struts.tiles.ComponentDefinition definition,
                                   HttpServletRequest request)
                            throws Exception
Determine the dispatcher path for the given Tiles definition, i.e. the request dispatcher path of the layout page.

Parameters:
definition - the Tiles definition to render
request - current HTTP request
Returns:
the path of the layout page to render
Throws:
Exception - if preparations failed

WebWork Project Page