SV: [opencms-dev] JSP2 issue escaping EL expressions incms:contentload
Sebastian Himberger
sebastian.himberger at gmx.de
Sun Sep 24 17:25:45 CEST 2006
Hi,
i think Stefans suggestion this would be a good solution and would make
binding of OpenCms values to custom tags much easier. Maybe it would
make sense to make the name somehow configurable (through a property or
something). Even things like properties could be accessed through a
lazyly initialized Map. So you can use something like this:
<c:out value="${cms.currFile.properties['template']}"/>
<c:out value="${cms.currFile.uri"/>
best regards
Sebastian
Stefan Uldum Grinsted schrieb:
>
> Hi Alex
>
> Why not make use of the built-in EL instead? By making all the
> accessible macro-objects available in the pageContext, like an opencms
> object with the name “opencms”, the current macroform can still be
> used. It will then use the EL, resolve to the opencms object in the
> page context and call getUri() from there.
>
> Or is there a particular reason rtexprvalue is disabled for most
> opencms tag attributes?
>
> / Stefan
>
> ------------------------------------------------------------------------
>
> *Fra:* opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] *På vegne af *Alexander Kandzior
> *Sendt:* 20. september 2006 17:38
> *Til:* 'The OpenCms mailing list'
> *Emne:* RE: [opencms-dev] JSP2 issue escaping EL expressions
> incms:contentload
>
> Stefan,
>
> I do not have an immediate solution to the issue now, but for future
> OpenCms releases there will be an alternative form of OpenCms macros
> to avoid the confilct with the JSP EL.
>
> Currently, the idea is to allow the follwoing alternate macro syntax:
>
> **%(VALUE)**
>
> as opposed to the current
>
> **${VALUE}**
>
> The old syntax will still work, so the new one will only be an
> alternative.
>
> I am open to suggenstions regarding the alternate macro form. I want
> to make sure that we do not conflict with other macro languages.
>
> Kind Regards,
> Alex.
>
> -------------------
> Alexander Kandzior
>
> Alkacon Software GmbH - The OpenCms Experts
> http://www.alkacon.com <http://www.alkacon.com/> -
> http://www.opencms.org <http://www.opencms.org/>
>
> ------------------------------------------------------------------------
>
> *From:* opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] *On Behalf Of *Stefan
> Uldum Grinsted
> *Sent:* Wednesday, September 20, 2006 2:26 PM
> *To:* 'The OpenCms mailing list'
> *Subject:* [opencms-dev] JSP2 issue escaping EL expressions in
> cms:contentload
>
> Hi all
>
> Last year, 30 November 2005 17:36, Scott Shealy asked the list
> about an issue with using the “${opencms.uri}” parameter for
> <cms:contentload /> in a JSP2 environment. And I have the same
> issue. Did anyone ever find a resolution for this?
>
> The default way to escape the EL resolver is to use \${…} and that
> work great in all other tag libs, even in my own. But when I pass
> “\${opencms.uri} to the param attribute of cms:contentload, the
> generated java-code contains a strange character (char 27) in
> front of {opencms.uri} rather than the $. The char 27 is the ASCII
> escape character, but how does that end up there?
>
> I know the directives of the jsp’s are treated by opencms, before
> they are written to the rfs (where it still looks as expected),
> but does opencms do something during java-code generation of the
> jsp’s? - Because that’s where it seems to go wrong.
>
> If I have the following two lines next to each other in a jsp:
>
> <c:out value="\${opencms.uri}" />
>
> <cms:contentload collector="singleFile" param="\${opencms.uri}"
> editable="true">
>
> The java-generated code for the two lines looks like this:
>
> // c:out
>
> org.apache.taglibs.standard.tag.rt.core.OutTag _jspx_th_c_out_0 =
> (org.apache.taglibs.standard.tag.rt.core.OutTag)
> _jspx_tagPool_c_out_value_nobody.get(org.apache.taglibs.standard.tag.rt.core.OutTag.class);
>
> _jspx_th_c_out_0.setPageContext(_jspx_page_context);
>
> _jspx_th_c_out_0.setParent(null);
>
> _jspx_th_c_out_0.setValue(new String("${opencms.uri}"));
>
> /* snip */
>
> // cms:contentload
>
> org.opencms.jsp.CmsJspTagContentLoad _jspx_th_cms_contentload_0 =
> (org.opencms.jsp.CmsJspTagContentLoad)
> _jspx_tagPool_cms_contentload_param_editable_collector.get(org.opencms.jsp.CmsJspTagContentLoad.class);
>
> _jspx_th_cms_contentload_0.setPageContext(_jspx_page_context);
>
> _jspx_th_cms_contentload_0.setParent((javax.servlet.jsp.tagext.Tag)
> _jspx_th_c_catch_0);
>
> _jspx_th_cms_contentload_0.setCollector("singleFile");
>
> _jspx_th_cms_contentload_0.setParam("{opencms.uri}");
>
> _jspx_th_cms_contentload_0.setEditable("true");
>
> Here you see the strange non-readable ASCII escape char in front
> of the opencms.uri for cms:contentload but not for c:out, which
> really puzzles me.
>
> Does anyone have any resolutions or suggestions? any leads? Anything?
>
> Thanx in advance.
>
> / Stefan
>
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> 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