[opencms-dev] Check if element exists
Yves Glodt
yg at mind.lu
Tue Mar 29 16:45:35 CEST 2011
Hi Mario,
in fact the element exists in the page, so yes, I wonder why isEmpty returns
"true".
And I also wonder why the 2 other calls return false... :-)
Is there another way to check whether an element exists in a page?
The example here does also not work as I expect:
http://opencms-wiki.org/EL_functions_provided_by_OpenCMS_taglib#XML_content
Maybe I expect something impossible. As said, my page is a simple "page with
free text"
On 29 March 2011 16:13, Mario Jäger <m.jaeger at alkacon.com> wrote:
> Hi Yves,
>
> I assume, that you are wondering over the (second) return value "true",
> because the element does not exist in your xml content. With the three
> function calls you use, methods in
> org.opencms.jsp.util.CmsJspContentAccessValueWrapper.java are used. The
> second call uses the method getIsEmpty() in that class. And that method
> also returns true for non existing values. The description for that
> method says: Returns true in case the value is empty, that is either
> null or an empty String.
>
> Kind Regards,
> Mario.
>
> Am 29.03.2011 14:58, schrieb Yves Glodt:
> > Hello,
> >
> > I try to check if an element exists in a "page with free text", and if
> > yes, include it.
> >
> > The check I do like this (in a c:if), but these 3 calls return "false,
> > true, false" (in order of appearance)
> >
> ${cms:vfs(pageContext).xml[cms:vfs(pageContext).context.uri].hasValue['rcontent']}
> >
> ${cms:vfs(pageContext).xml[cms:vfs(pageContext).context.uri].value['rcontent'].isEmpty}
> >
> ${cms:vfs(pageContext).xml[cms:vfs(pageContext).context.uri].value['rcontent'].exists}
> >
> > What is wrong about this?
> >
> > Best regards,
> > Yves
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > 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
>
>
> --
> -------------------
> Mario Jäger
>
> Visit OpenCms Days 2011 Conference and Expo
> May 9 to May 10 2011 in Cologne, Germany
> http://www.opencms-days.org
>
> Alkacon Software GmbH - The OpenCms Experts
> http://www.alkacon.com - http://www.opencms.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20110329/1417a656/attachment.htm>
More information about the opencms-dev
mailing list