Edit on GitHub << back to Tag Reference

# include

Please make sure you have read the Tag Syntax document and understand how tag attribute syntax works.

## Description

Include a servlet’s output (result of servlet or a JSP page)

> Note: Any additional params supplied to the included page are not accessible within the rendered page through the `<s:property.../>` tag since no ValueStack will be created. You can, however, access them in a servlet via the HttpServletRequest object or from a JSP page via a scriptlet.

### How to access parameters

Parameters are passed as request parameters, so use the `${param.paramName}` notation to access them. Do not use the `<s:property/>` tag to access parameters in included files.

Below it’s an example how you can access parameters passed into the included page:

with scope:

    <s:set var="innerName" scope="page">${param.paramName}</s:set>
    <s:property value="#attr.innerName"/>

with no scope:

    <s:set var="innerName">${param.paramName}</s:set>
    <s:property value="innerName"/>
    <s:property value="#attr.innerName"/>
    <s:property value="#innerName"/>

> Note: You can access such params without using JSTL, just use `${param.paramName}` notation.

## Attributes

#### Dynamic Attributes Allowed: false
#### Name | #### Required | #### Default | #### Evaluated | #### Type | #### Description
--- | --- | --- | --- | --- | ---
performClearTagStateForTagPoolingServers | false | false | false | Boolean | Whether to clear all tag state during doEndTag() processing (if applicable)
value | true |  | false | String | The jsp/servlet output to include

## Example

Example 1

    <s:include value="myJsp.jsp" />

do an include myJsp.jsp page

Example 2

    <s:include value="myJsp.jsp">
       <s:param name="param1" value="value2" />
       <s:param name="param2" value="value2" />
    </s:include>

do an include to `myJsp.jsp` page with parameters `param1=value1` and `param2=value2`

Example 3

    <s:include value="myJsp.jsp">
       <s:param name="param1">value1</s:param>
       <s:param name="param2">value2</s:param>
    </s:include>

do an include to `myJsp.jsp` page with parameters `param1=value1` and `param2=value2`

Example 4

accessing passed parameters in the included page

with scope:

    <s:set var="param1" scope="page">${param.param1}</s:set>
    <s:property value="#attr.param1"/>

with no scope:

    <s:set var="param2">${param.param2}</s:set>
    <s:property value="param2"/>

    <s:property value="#attr.param2"/>
    <s:property value="#param2"/>