[opencms-dev] Re: JSTL Expression Language and OpenCms Macro Excpressions

Fabian Huber fabian.huber at gmail.com
Mon Aug 14 09:35:55 CEST 2006


Hello Toni,

that's exactly what I want!

Thank you for your great support (and the patience ;-)

Best regards,
Fabian

2006/8/13, Toni PĂ©rez <tp.ocms at gmail.com>:
>
> On 13/08/06, Fabian Huber <fabian.huber at gmail.com> wrote:
> > Hello Toni,
> >
> > * Yes, I reverted all my changes in the web.xml file.
> >
> > * The start tag in the web.xml file is:
> > <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> > http://java.sun.com/xml/ns/j2ee
> > http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
> >
> > * The jsp where the problem exists, doesn't use any taglib. The problem
> is,
> > when I try to use OpenCms Macro Expressions. Here is an example:
> >
> > <%@ page session="false" %>
> > <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
> >     <jsp:useBean id="cms" class="org.opencms.jsp.CmsJspActionElement">
> >
> >     <link rel="stylesheet" type="text/css"
> > href="sites/default/kljb/css/articlemodule.css">
> >
> >     <%
> >         cms.init(pageContext, request, response);
> >
> >          // get the template
> >         String template = cms.property("template", "search");
> >
> >         // The page header
> >     cms.include(template, "head");
> >         // end of template head
> >
> >     String number = "${number}";
> >
> >     %>
> >     <h1> Gallery</h1>
> >
> >
> >     <cms:contentload collector="allInFolderDateReleasedDesc"
> > param="/kljb/gallery/photos/galery_${number}|photoalbum"
> editable="true">
> >     <table border="0" width="100%">
> >     <tr><td width="50%">
> >         <h2><cms:contentshow element="Title" /></h2>
> >     </td>
> >     <td>
> >         <cms:contentloop element="Thumbs">
> >         <cms:contentshow element="TextBottom" />
> >         </cms:contentloop>
> >     </td>
> >     </tr>
> >     <tr>
> >     <td>
> >         <cms:contentloop element="Thumbs">
> >         <cms:contentshow element="TextTop" />
> >         </cms:contentloop>
> >     </td>
> >     <td>
> >         <a href="<cms:link><cms:contentshow element="${opencms.filename
> }"
> > /></cms:link>">Ansehen</a>
> >     </td>
> >
> >     </tr>
> >     </table>
> >
> >     <br/><br/>
> >
> >     </cms:contentload>
> >
> >
> >
> >
> >     <%
> >
> >         // The page foot
> >         cms.include(template, "foot");
> >
> >     %>
> >
> > </jsp:useBean>
> >
> >
> > The JSTL Library is parsing this file and takes the parts underlined as
> > Expression Language. In fact, these parts are OpenCms Macro. Both
> languages
> > have the same syntax. So this is the problem. (I don't know, why the
> OpenCms
> > developers decided to take the syntax of Expression Language for Macro
> > Expression, too. Ist there any sense?)
> >
> > You are working with macros in your jsp files and don't get this
> problem?
> >
> > Regards,
> > Fabian
>
>
> Hello, Fabian!
>
> Short answer:
> In that JSP you could insert the following statement at the beginning:
> <%@ page isELIgnored="true" %>
> You could see this page to read a little explanation:
> http://java.sun.com/products/jsp/syntax/2.0/syntaxref2010.html#15653
>
>
> Not so short answer:
> You could read the "A.1.1.How JSTL 1.1 Backwards Compatibility is
> Achieved" point of the JSTL 1.1 specification downloable from here:
> http://jcp.org/aboutJava/communityprocess/final/jsr052/index2.html
>
> I paste the most important sentences (in my opinion) of that point:
> "The key difference between JSTL 1.0 and JSTL 1.1 is that the
> expression language
> (EL) has moved from the JSTL specification to the JSP specification. The
> EL is
> therefore now part of the JSP 2.0 specification, and JSTL 1.1 requires JSP
> 2.0
> (J2EE 1.4 platform).
>
> A web application developed for JSP 1.2 has a servlet 2.3 deployment
> descriptor
> (web.xml). JSP 2.0 provides backwards compatibility for JSP 1.2 web
> applications by
> disabling by default the EL machinery (i.e. evaluation of EL expressions)
> when a
> web application has a servlet 2.3 deployment descriptor. A web application
> that
> uses JSTL 1.0 and which is deployed with a servlet 2.3 deployment
> descriptor
> therefore runs without any modification in a J2EE 1.4 environment because
> EL
> expressions are ignored by JSP 2.0, and JSTL 1.0 keeps evaluating them as
> was
> the case with JSP 1.2."
>
> I hope this helps this time. ;-)
> Regards.
>     Toni.
>
> P.S.: I also don't know why Alkacon use a syntax similar to the EL in
> their Macro Expressions.
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060814/263b5ef3/attachment.htm>


More information about the opencms-dev mailing list