include()
method
This method is used to include files from the OpenCms VFS dynamically at runtime. The included file is treated like a request with optional additional request parameters.
Parameters:
Name | Description |
java.lang.String target | The URI of the included resource in the OpenCms VFS. |
Parameters:
Name | Description |
java.lang.String target | see above |
java.lang.String element | If the included JSP page is split into elements by the template() method, only the specified element of the JSP page is included. |
Parameters:
Name | Description |
java.lang.String target | see above |
java.lang.String element | see above |
java.util.Map parameterMap | Additional parameters that are passed to the included file. |
Example usage:
Include the JSP page "some_page.html":
com.opencms.flex.jsp.CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response); cms.include("some_page.html");
Read the name of the file to be included from the property "template" on the current file:
com.opencms.flex.jsp.CmsJspActionElement cms = new com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response); cms.include(cms.property("template"));
Add additionally some key/value coded parameters to the request parameters hashtable to pass them to the included file:
com.opencms.flex.jsp.CmsJspActionElement cms = new com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response); java.util.HashMap parameters = new java.util.HashMap(); parameters.put("__locale", locale); parameters.put("__navpart", "toprow"); cms.include("../elements/template-nav-top.jsp", null, parameters);
Include the element "head" from the JSP page specified by the "template" property:
com.opencms.flex.jsp.CmsJspActionElement cms = new com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response); cms.include(cms.property("template"), "head");]]>
include()
method
This method is used to include files from the OpenCms VFS dynamically at runtime. The included file is treated like a request with optional additional request parameters.
Parameters:
Name | Description |
java.lang.String target | The URI of the included resource in the OpenCms VFS. |
Parameters:
Name | Description |
java.lang.String target | see above |
java.lang.String element | If the included JSP page is split into elements by the template() method, only the specified element of the JSP page is included. |
Parameters:
Name | Description |
java.lang.String target | see above |
java.lang.String element | see above |
java.util.Map parameterMap | Additional parameters that are passed to the included file. |
Example usage:
Include the JSP page "some_page.html":
com.opencms.flex.jsp.CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response); cms.include("some_page.html");
Read the name of the file to be included from the property "template" on the current file:
com.opencms.flex.jsp.CmsJspActionElement cms = new com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response); cms.include(cms.property("template"));
Add additionally some key/value coded parameters to the request parameters hashtable to pass them to the included file:
com.opencms.flex.jsp.CmsJspActionElement cms = new com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response); java.util.HashMap parameters = new java.util.HashMap(); parameters.put("__locale", locale); parameters.put("__navpart", "toprow"); cms.include("../elements/template-nav-top.jsp", null, parameters);
Include the element "head" from the JSP page specified by the "template" property:
com.opencms.flex.jsp.CmsJspActionElement cms = new com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response); cms.include(cms.property("template"), "head");]]>