[opencms-dev] Where does JSP code get {cms.???} values?

Stephan Hartmann hartmann at metamesh.de
Tue May 12 21:51:15 CEST 2009


Hi David,

at the beginning of the JSP you can see that an object of type 
CmsTemplateLayout is initialized:

    CmsTemplateLayout cms = new CmsTemplateLayout(pageContext, request, 
response);

and then put as an attribute into the page context scope:
    pageContext.setAttribute("cms", cms);

Now this instance is used in the JSP in Expression Language as a bean, 
meaning every getXXX() instance method of this object with no arguments 
can be used in EL code, e.g. the CmsTemplateLayout.getOptions() method 
by writing "${cms.options}" to retrieve the "attribute" named "options" 
of the bean.
The returnd object can be used again as a bean in EL and so on.
Note that ${cms.options.value}respectively 
CmsJspContentAccessBean.getValue() actually returns an instance of 
java.util.Map whose values are retrieved by appending the name of the 
key in brackets (seems that the usage in Expression Language had 
influence on the naming of this method).
In this case, the type of the returned object of the map is 
CmsJspContentAccessValueWrapper whose getResolveMacros() (bean attribute 
"resolveMacros") method ist called afterwards. This method again returns 
an object of type CmsJspContentAccessValueWrapper. As there are no more 
method calls, the Expression Language evaluation is done and the c:out 
tag calls the toString() method of returned object.

Best regards,
Stephan
 
David Goodenough schrieb:
> In the template-two code, in main.jsp line 62, there is the following
> line:-
>
> <c:out value="${cms.options.value['Header'].resolveMacros}" 
> escapeXml="false" />
>
> Now I the JSTL, but I do not know where it finds the value for 
> ${cms.options.value['Header'].resolveMacros}.  I have looked right
> through the OpenCMS JSP documentation and I can find no reference to this kind
> of variable in any of the examples or in the text.  There are various other
> ${cms.???} values used in this template as well.
>
> Is there any documentation as to where these values are picked up 
> from, and how I can set them for a site/folder/page?  It feels as though
> it should be in the properties, but I am not sure.
>
> David
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>   




More information about the opencms-dev mailing list