|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts2.components.Component
org.apache.struts2.components.Include
public class Include
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" /> </s:include> <-- Three: --> <s:include value="myJsp.jsp"> <s:param name="param1">value1</s:param> <s:param name="param2">value2</s:param> </s:include> 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 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(String key,
Object value)
Adds the given key and value to this component's own parameter. |
boolean |
end(Writer writer,
String body)
Callback for the end tag of this component. |
static String |
getContextRelativePath(javax.servlet.ServletRequest request,
String relativePath)
|
static void |
include(String relativePath,
Writer writer,
javax.servlet.ServletRequest request,
javax.servlet.http.HttpServletResponse response)
Deprecated. use include(String, java.io.Writer, javax.servlet.ServletRequest,
javax.servlet.http.HttpServletResponse, String) instead with correct encoding specified |
static void |
include(String relativePath,
Writer writer,
javax.servlet.ServletRequest request,
javax.servlet.http.HttpServletResponse response,
String encoding)
Include a resource in a response. |
void |
setDefaultEncoding(String encoding)
|
void |
setValue(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, setUrlHelper, 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 String value
Constructor Detail |
---|
public Include(ValueStack stack, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
Method Detail |
---|
public void setDefaultEncoding(String encoding)
public boolean end(Writer writer, String body)
Component
end
in class Component
writer
- the output writer.body
- the rendered body.
public void setValue(String value)
public static String getContextRelativePath(javax.servlet.ServletRequest request, String relativePath)
public void addParameter(String key, Object value)
Component
addParameter
in class Component
key
- the key of the new parameter to add.value
- the value assoicated with the key.public static void include(String relativePath, Writer writer, javax.servlet.ServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
include(String, java.io.Writer, javax.servlet.ServletRequest,
javax.servlet.http.HttpServletResponse, String)
instead with correct encoding specified
javax.servlet.ServletException
IOException
public static void include(String relativePath, Writer writer, javax.servlet.ServletRequest request, javax.servlet.http.HttpServletResponse response, String encoding) throws javax.servlet.ServletException, IOException
relativePath
- the relative path of the resource to include; resolves to getContextRelativePath(javax.servlet.ServletRequest,
String)
writer
- the Writer to write output torequest
- the current requestresponse
- the response to write toencoding
- the file encoding to use for including the resource; if null, it will default to the
platform encoding
javax.servlet.ServletException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |