|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.opencms.jsp.CmsJspBean
org.opencms.jsp.CmsJspActionElement
Bean to be used in JSP scriptlet code that provides direct access to the functionality offered by the opencms taglib.
By instanciating a bean of this type and accessing the methods provided by the instance, all functionality of the OpenCms JSP taglib can be easily used from within JSP scriplet code.
Initialize this bean at the beginning of your JSP like this:
<jsp:useBean id="cms" class="org.opencms.jsp.CmsJspActionElement"> <% cms.init(pageContext, request, response); %> </jsp:useBean>You can also access the current users
CmsObject
by using CmsJspBean.getCmsObject().All exceptions that occur when calling any method of this class are catched and written to the log output only, so that a template still has a chance of working at least in some elements.
| Field Summary | |
static CmsMessageContainer |
NOT_INITIALIZED
Error message in case bean was not properly initialized. |
| Constructor Summary | |
CmsJspActionElement()
Empty constructor, required for every JavaBean. |
|
CmsJspActionElement(PageContext context,
HttpServletRequest req,
HttpServletResponse res)
Constructor, with parameters. |
|
| Method Summary | |
void |
editable(boolean isEditable)
Includes direct edit scriptlets, same as using the <cms:editable /> tag. |
void |
editable(boolean isEditable,
String filename)
Includes direct edit scriptlets, same as using the <cms:editable file="***" />tag. |
String |
getContent(String target)
Returns the processed output of an OpenCms resource in a String. |
String |
getContent(String target,
String element,
Locale locale)
Returns the processed output of an element within an OpenCms resource. |
CmsMessages |
getMessages(String bundleName,
String language)
Generates an initialized instance of CmsMessages for
convenient access to localized resource bundles. |
CmsMessages |
getMessages(String bundleName,
String language,
String defaultLanguage)
Generates an initialized instance of CmsMessages for
convenient access to localized resource bundles. |
CmsMessages |
getMessages(String bundleName,
String language,
String country,
String variant,
String defaultLanguage)
Generates an initialized instance of CmsMessages for
convenient access to localized resource bundles. |
CmsJspNavBuilder |
getNavigation()
Returns an initialized CmsJspNavBuilder instance. |
void |
include(String target)
Include a sub-element without paramters from the OpenCms VFS, same as using the <cms:include file="***" /> tag. |
void |
include(String target,
String element)
Include a named sub-element without paramters from the OpenCms VFS, same as using the <cms:include file="***" element="***" /> tag. |
void |
include(String target,
String element,
boolean editable)
Include a named sub-element without paramters from the OpenCms VFS, same as using the <cms:include file="***" element="***" /> tag. |
void |
include(String target,
String element,
boolean editable,
Map parameterMap)
Include a named sub-element with paramters from the OpenCms VFS, same as using the <cms:include file="***" element="***" /> tag
with parameters in the tag body. |
void |
include(String target,
String element,
Map parameterMap)
Include a named sub-element with paramters from the OpenCms VFS, same as using the <cms:include file="***" element="***" /> tag
with parameters in the tag body. |
void |
includeSilent(String target,
String element)
Includes a named sub-element supressing all Exceptions that occur during the include, otherwise the same as using include(String, String, Map). |
void |
includeSilent(String target,
String element,
boolean editable)
Includes a named sub-element supressing all Exceptions that occur during the include, otherwise the same as using include(String, String, Map). |
void |
includeSilent(String target,
String element,
boolean editable,
Map parameterMap)
Includes a named sub-element supressing all Exceptions that occur during the include, otherwise the same as using include(String, String, Map). |
void |
includeSilent(String target,
String element,
Map parameterMap)
Includes a named sub-element supressing all Exceptions that occur during the include, otherwise the same as using include(String, String, Map). |
String |
info(String property)
Returns an OpenCms or JVM system info property value, same as using the <cms:info property="***" /> tag. |
String |
label(String label)
Returns an OpenCms workplace label. |
String |
link(String link)
Calculate a link with the OpenCms link management, same as using the <cms:link>***</cms:link> tag. |
Map |
properties()
Returns all properites of the current file. |
Map |
properties(String file)
Returns all properites of the selected file. |
String |
property(String name)
Returns a selected file property value, same as using the <cms:property name="***" /> tag or
calling property(String, String, String, boolean). |
String |
property(String name,
String file)
Returns a selected file property value, same as using the <cms:property name="***" file="***" /> tag or
calling property(String, String, String, boolean). |
String |
property(String name,
String file,
String defaultValue)
Returns a selected file property value, same as using the <cms:property name="***" file="***" default="***" /> tag or
calling property(String, String, String, boolean). |
String |
property(String name,
String file,
String defaultValue,
boolean escapeHtml)
Returns a selected file property value with optional HTML escaping, same as using the <cms:property name="***" file="***" default="***" /> tag. |
boolean |
template(String element)
Checks if a template part should be used or not, same as using the <cms:template element="***" /> tag. |
boolean |
template(String elementlist,
boolean checkall)
Checks if a template part should be used or not, same as using the <cms:template ifexists="***" /> tag. |
boolean |
template(String element,
String elementlist,
boolean checkall)
Checks if a template part should be used or not, same as using the <cms:template element="***" ifexists="***" /> tag. |
String |
toAbsolute(String target)
Converts a relative URI in the OpenCms VFS to an absolute one based on the location of the currently processed OpenCms URI. |
String |
user(String property)
Returns a selected user property, i.e. |
| Methods inherited from class org.opencms.jsp.CmsJspBean |
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, init, isNotInitialized, isSupressingExceptions, setSupressingExceptions |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final CmsMessageContainer NOT_INITIALIZED
| Constructor Detail |
public CmsJspActionElement()
public CmsJspActionElement(PageContext context,
HttpServletRequest req,
HttpServletResponse res)
context - the JSP page context objectreq - the JSP requestres - the JSP response| Method Detail |
public void editable(boolean isEditable)
throws JspException
<cms:editable /> tag.
isEditable - include scriptlets only if true
JspException - if something goes wrong
public void editable(boolean isEditable,
String filename)
throws JspException
<cms:editable file="***" />tag.
isEditable - include scriptlets only if truefilename - file with scriptlets
JspException - if something goes wrongpublic String getContent(String target)
target - the target to process
public String getContent(String target,
String element,
Locale locale)
target - the target to processelement - name of the elementlocale - locale of the element
public CmsMessages getMessages(String bundleName,
String language)
CmsMessages for
convenient access to localized resource bundles.
bundleName - the name of the ResourceBundle to uselanguage - language indentificator for the locale of the bundle
public CmsMessages getMessages(String bundleName,
String language,
String defaultLanguage)
CmsMessages for
convenient access to localized resource bundles.
bundleName - the name of the ResourceBundle to uselanguage - language indentificator for the locale of the bundledefaultLanguage - default for the language, will be used
if language is null or empty String "", and defaultLanguage is not null
public CmsMessages getMessages(String bundleName,
String language,
String country,
String variant,
String defaultLanguage)
CmsMessages for
convenient access to localized resource bundles.
bundleName - the name of the ResourceBundle to uselanguage - language indentificator for the locale of the bundlecountry - 2 letter country code for the locale of the bundlevariant - a vendor or browser-specific variant codedefaultLanguage - default for the language, will be used
if language is null or empty String "", and defaultLanguage is not null
ResourceBundle,
CmsMessagespublic CmsJspNavBuilder getNavigation()
CmsJspNavBuilder instance.
CmsJspNavBuilderCmsJspNavBuilder
public void include(String target)
throws JspException
<cms:include file="***" /> tag.
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)
JspException - in case there were problems including the targetCmsJspTagInclude
public void include(String target,
String element)
throws JspException
<cms:include file="***" element="***" /> tag.
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)element - the element (template selector) to display from the target
JspException - in case there were problems including the targetCmsJspTagInclude
public void include(String target,
String element,
boolean editable)
throws JspException
<cms:include file="***" element="***" /> tag.
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)element - the element (template selector) to display from the targeteditable - flag to indicate if element is editable
JspException - in case there were problems including the targetCmsJspTagInclude
public void include(String target,
String element,
boolean editable,
Map parameterMap)
throws JspException
<cms:include file="***" element="***" /> tag
with parameters in the tag body.The parameter map should be a map where the keys are Strings (the parameter names) and the values are of type String[]. However, as a convenience feature, in case you provide just a String for the parameter value, it will automatically be translated to a String[1].
The handling of the element parameter depends on the
included file type. Most often it is used as template selector.
Important: Exceptions that occur in the include process are NOT
handled even if CmsJspBean.setSupressingExceptions(boolean) was set to true.
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)element - the element (template selector) to display from the targeteditable - flag to indicate if element is editableparameterMap - a map of the request parameters
JspException - in case there were problems including the targetCmsJspTagInclude
public void include(String target,
String element,
Map parameterMap)
throws JspException
<cms:include file="***" element="***" /> tag
with parameters in the tag body.
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)element - the element (template selector) to display from the targetparameterMap - a map of the request parameters
JspException - in case there were problems including the targetCmsJspTagInclude
public void includeSilent(String target,
String element)
include(String, String, Map).This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)element - the element (template selector) to display from the target
public void includeSilent(String target,
String element,
boolean editable)
include(String, String, Map).This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)element - the element (template selector) to display from the targeteditable - flag to indicate if element is editable
public void includeSilent(String target,
String element,
boolean editable,
Map parameterMap)
include(String, String, Map).This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)element - the element (template selector) to display from the targeteditable - flag to indicate if element is editableparameterMap - a map of the request parameters
public void includeSilent(String target,
String element,
Map parameterMap)
include(String, String, Map).This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)element - the element (template selector) to display from the targetparameterMap - a map of the request parameterspublic String info(String property)
<cms:info property="***" /> tag.
See the description of the class CmsJspTagInfo for a detailed list
of available options for the property value.
property - the property to look up
CmsJspTagInfopublic String label(String label)
You should consider using a standard
java.util.ResourceBundle instead of the
OpenCms workplace language files.
label - the label to look up
CmsJspTagLabelpublic String link(String link)
<cms:link>***</cms:link> tag.This is important to get the right link for exported resources, e.g. for images in the online project.
link - the uri in the OpenCms to link to
CmsJspTagLinkpublic Map properties()
public Map properties(String file)
Please see the description of the class CmsJspTagProperty for
valid options of the file parameter.
file - the file (or folder) to look at for the properties
CmsJspTagPropertypublic String property(String name)
<cms:property name="***" /> tag or
calling property(String, String, String, boolean).
name - the name of the property to look for
property(String, String, String, boolean),
CmsJspTagProperty
public String property(String name,
String file)
<cms:property name="***" file="***" /> tag or
calling property(String, String, String, boolean).
name - the name of the property to look forfile - the file (or folder) to look at for the property
property(String, String, String, boolean),
CmsJspTagProperty
public String property(String name,
String file,
String defaultValue)
<cms:property name="***" file="***" default="***" /> tag or
calling property(String, String, String, boolean).
name - the name of the property to look forfile - the file (or folder) to look at for the propertydefaultValue - a default value in case the property was not found
property(String, String, String, boolean),
CmsJspTagProperty
public String property(String name,
String file,
String defaultValue,
boolean escapeHtml)
<cms:property name="***" file="***" default="***" /> tag.
Please see the description of the class CmsJspTagProperty for
valid options of the file parameter.
name - the name of the property to look forfile - the file (or folder) to look at for the propertydefaultValue - a default value in case the property was not foundescapeHtml - if true, special HTML characters in the return value
are escaped with their number representations (e.g. & becomes &)
CmsJspTagPropertypublic boolean template(String element)
<cms:template element="***" /> tag.
element - the template element to check
true if the element is active, false otherwiseCmsJspTagUser
public boolean template(String elementlist,
boolean checkall)
<cms:template ifexists="***" /> tag.
elementlist - the list of elements to checkcheckall - true if all elements in the list should be checked
true if the elements available, false otherwiseCmsJspTagUser
public boolean template(String element,
String elementlist,
boolean checkall)
<cms:template element="***" ifexists="***" /> tag.
element - the template element to checkelementlist - the list of elements to checkcheckall - true if all elements in the list should be checked
true if the element is active, false otherwiseCmsJspTagUserpublic String toAbsolute(String target)
target - the relative URI to convert
public String user(String property)
<cms:user property="***" /> tag.
property - the user property to display, please see the tag documentation for valid options
CmsJspTagUser
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||