org.apache.struts2.views.tiles

## Class TilesResult

- java.lang.Object
- - org.apache.struts2.result.StrutsResultSupport
  - - org.apache.struts2.result.ServletDispatcherResult
    - - org.apache.struts2.views.tiles.TilesResult

- All Implemented Interfaces:
    Serializable, Result, StrutsStatics

      public class TilesResult
      extends ServletDispatcherResult

  Renders a view using struts-tiles. In your web.xml file, you need to add a TilesListener.

  <listener> <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class> </listener>

  In struts.xml, use type="tiles" on your <result>.

  <action name="editUser" class="userAction" method="edit"> <result name="success" type="tiles">userForm</result> <result name="input" type="tiles">userList</result> </action>

  Making this result type the default for the current package.

  <result-types> <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" default="true" /> </result-types>

  You have to configure tiles itself. Therefore you can add `tiles.xml` either to resources or WEB-INF. You may also use annotations like `TilesDefinition`.

  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.opensymphony.xwork2.Result

      `Result.LegacyAdapter`

  - ### Field Summary

    - ### Fields inherited from class org.apache.struts2.result.StrutsResultSupport

      `DEFAULT_PARAM, DEFAULT_URL_ENCODING, parseLocation`

    - ### Fields inherited from interface org.apache.struts2.StrutsStatics

      `ACTION_MAPPING, HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TilesResult()`
    `TilesResult(String location)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `doExecute(String location, ActionInvocation invocation)` Dispatches to the given location.

    - ### Methods inherited from class org.apache.struts2.result.ServletDispatcherResult

      `getParameters, setQueryStringParser`

    - ### Methods inherited from class org.apache.struts2.result.StrutsResultSupport

      `conditionalParse, conditionalParseCollection, doExecute, execute, getLastFinalLocation, getLocation, setEncode, setLocation, setParse`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.opensymphony.xwork2.Result

      `adapt, execute`

- - ### Constructor Detail

    - #### TilesResult

          public TilesResult()

    - #### TilesResult

          public TilesResult(String location)

  - ### 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.

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.