[opencms-dev] Java Expression Language EL Question

Schliemann, Kai K.Schliemann at comundus.com
Thu Nov 20 18:04:56 CET 2014


Hi Babak,
maybe this helps:

8.2 Accessing OpenCms functionality via the EL

OpenCms comes with several Java beans to provide access to OpenCms-specific functionality in JSPs. In general, if required, an object of each bean could be made available separately in a JSP. Also several tags of the <cms:> taglib initialize and expose objects of such beans (see section 8.1).

Since OpenCms 9.0.1 the variable cms is present in the page scope for each JSP. It makes an object of type org.opencms.jsp.util.CmsJspStandardContextBean available. The object provides a convenient way to access the most important OpenCms functions via JSTL/EL. Thus, in most cases no bean at all has to be included and initialized manually, and also formerly required use of scriptlet code becomes obsolete.
The standard context bean has a very rich interface. In particular, access to several other Java beans shipped with OpenCms is granted. A complete overview of the functionality exposed via the standard context bean can be looked up in the JavaDoc of the current OpenCms version. Look up the documentation of the class CmsJspStandardContextBean. Starting there, you can easily explore the interfaces of all other beans accessible via the standard context bean as well. Aware of the naming conventions for Java Beans, you obtain an overview of the properties available in EL.

Taken from the documentation pdf shipped with OpenCms 9.0.1.
If you need it, let me know.

Best regards
Kai

Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Babak
Gesendet: Donnerstag, 20. November 2014 17:56
An: opencms-dev at opencms.org
Betreff: Re: [opencms-dev] Java Expression Language EL Question

And with doing a bit more research found that http://www.opencms.org/taglib/cms is mapped to /WEB-INF/opencms.tld in web.xml

    <jsp-config>
        <taglib>
            <taglib-uri>http://www.opencms.org/taglib/cms</taglib-uri>
            <taglib-location>/WEB-INF/opencms.tld</taglib-location>
        </taglib>
    </jsp-config>


So CMsJspLoader is going to load taglib.cms from /WEB-INF/opencms.tld
but still can't track cms.element in tag library file.
does CMsJspLoader actually instantiate cms object when it loads it ?

even I don't know how ${cms.locale} is being translated.

Thanks for help.

Babak

On 11/20/2014 2:23 AM, Babak wrote:
So I did a bit of research and found that all usable taglibs are defined in the /WEB-INF/config/opencms-vfs.xml

    <loader class="org.opencms.loader.CmsJspLoader">
                    <param name="taglib.cms">http://www.opencms.org/taglib/cms</param>

but still can't figure how to translate ${cms.element.id} or ${cms.element.settings.boxschema}



On 11/19/2014 8:00 PM, Babak wrote:
I am trying to understand how ${cms.element.id}is being translated in below source code.

https://github.com/alkacon/vie-related/blob/master/resources/detail.jsp

I mean, where at source code I should look to find the result of ${cms.element.id}?

I know EL and I know cms is an object but in most of the codes I don't see any cms object
being instantiated, and it only being used in code.

Does cms object being instantiated implicitly ?
from which class and how do I find the result of <div class="box ${cms.element.settings.boxschema}">


Thanks
Babak
_______________________________________________
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/cgi-bin/mailman/listinfo/opencms-dev








_______________________________________________

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/cgi-bin/mailman/listinfo/opencms-dev







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20141120/ef592885/attachment.htm>


More information about the opencms-dev mailing list