Class Include

  extended by org.apache.struts2.components.Component
      extended by org.apache.struts2.components.Include

public class Include
extends Component

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.


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

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

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

 Example one - do an include myJsp.jsp page
 Example two - do an include to myJsp.jsp page with parameters param1=value1 and param2=value2
 Example three - do an include to myJsp.jsp page with parameters param1=value1 and param2=value2

Field Summary
protected  java.lang.String value
Fields inherited from class org.apache.struts2.components.Component
actionMapper, COMPONENT_STACK, parameters, stack, throwExceptionOnELFailure
Constructor Summary
Include(ValueStack stack, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
Method Summary
 void addParameter(java.lang.String key, java.lang.Object value)
          Adds the given key and value to this component's own parameter.
 boolean end( writer, java.lang.String body)
          Callback for the end tag of this component.
static java.lang.String getContextRelativePath(javax.servlet.ServletRequest request, java.lang.String relativePath)
static void include(java.lang.String aResult, writer, javax.servlet.ServletRequest request, javax.servlet.http.HttpServletResponse response)
 void setDefaultEncoding(java.lang.String encoding)
 void setValue(java.lang.String value)
Methods inherited from class org.apache.struts2.components.Component
addAllParameters, altSyntax, altSyntax, completeExpressionIfAltSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findStringIfAltSyntax, findValue, findValue, findValue, getComponentStack, getParameters, getStack, popComponentStack, setActionMapper, setThrowExceptionsOnELFailure, start, stripExpressionIfAltSyntax, stripExpressionIfAltSyntax, toString, usesBody
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected java.lang.String value
Constructor Detail


public Include(ValueStack stack,
               javax.servlet.http.HttpServletRequest req,
               javax.servlet.http.HttpServletResponse res)
Method Detail


public void setDefaultEncoding(java.lang.String encoding)


public boolean end( writer,
                   java.lang.String body)
Description copied from class: Component
Callback for the end tag of this component. Should the body be evaluated again?

NOTE: will pop component stack.

end in class Component
writer - the output writer.
body - the rendered body.
true if the body should be evaluated again


public void setValue(java.lang.String value)


public static java.lang.String getContextRelativePath(javax.servlet.ServletRequest request,
                                                      java.lang.String relativePath)


public void addParameter(java.lang.String key,
                         java.lang.Object value)
Description copied from class: Component
Adds the given key and value to this component's own parameter.

If the provided key is null nothing happens. If the provided value is null any existing parameter with the given key name is removed.

addParameter in class Component
key - the key of the new parameter to add.
value - the value assoicated with the key.


public static void include(java.lang.String aResult,
                           javax.servlet.ServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
                    throws javax.servlet.ServletException,

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.