[opencms-dev] Accessing XML content from scriptlet (was:How to show a gallery file title?)
Alessandro Magnolo
alessandro.magnolo at gmail.com
Thu Mar 17 09:29:38 CET 2005
I found a partial workaround for the issue in my previous posting (attached).
If I had the file name of the gallery file, I could get its title
using property() in a scriptlet.
Now the question is: how do I access the XML content from scriptlet?
And how do I loop on items that have multiple occurences?
Fow those who are new to OpenCms like me, here is the java code to get
a property from a file:
<%
org.opencms.jsp.CmsJspActionElement cms = new
org.opencms.jsp.CmsJspActionElement(pageContext, request, response);
String fileName="/xmlcontent/widgetdemo/downloads/download.txt";
String title = cms.property("Title", fileName);
%>
As you see, in my case I should read the file name from the XML
document, as I do with <cms:contentshow /> using tags.
Thanks to all willing to cooperate,
Alessandro Magnolo
On Tue, 15 Mar 2005 15:17:55 +0100, Alessandro Magnolo
<alessandro.magnolo at gmail.com> wrote:
> Hello All,
>
> I am learning to use opencms 6, and I found very useful the XML
> document feature.
>
> I have an XML document with multiple files attached, choosen from a
> download gallery. I would like to show the list of files, with the
> description that is assigned in the download gallery in the "Title"
> field.
>
> Here's the element definition in the document XSD:
> <xsd:element name="Allegati" type="OpenCmsVfsFile" minOccurs="0"
> maxOccurs="10" />
>
> And here is the JSP snippet:
> <ul>
> <cms:contentloop element="Allegati">
> <li>
> <a href="<cms:link><cms:contentshow /></cms:link>">
> <!-- here goes the item "title" as given in the gallery -->
> </a>
> </li>
> </cms:contentloop>
> </ul>
>
> Is it possible to see the file "title" in place of the comment in the JSP ?
>
> TIA,
> Alessandro Magnolo
>
More information about the opencms-dev
mailing list