[opencms-dev] Recommendation for <cms:contentload> tag
bessette
Bessette at pokemon-seattle.com
Fri Apr 27 20:48:48 CEST 2007
I needed to get the CmsResource object inside of the <cms:contentload>
tag, but the tag doesn't make the current resource available as a scripting
variable. So, I had to customize the org.opencms.jsp.CmsJspTagContentLoad
class to make that object available:
protected void doLoadNextFile() throws CmsException {
// get the next resource from the collector
CmsResource resource = getNextResource();
if (resource == null) {
m_resourceName = null;
m_content = null;
return;
}
pageContext.setAttribute( "resource", resource );
...
}
This customization allows me to access the current CmsResource like
${resource.name} (same as CmsResource.getName()). However, the variable
name "resource" is hardcoded. Most tags allow the user to specify the name
of the scripting variable using an "id" attribute on the tag. See
http://java.sun.com/j2ee/1.3/docs/tutorial/doc/JSPTags4.html#wp66315 for
reference.
Anyway, that's my suggested improvement.
Thanks,
Eric
--
View this message in context: http://www.nabble.com/Recommendation-for-%3Ccms%3Acontentload%3E-tag-tf3659249.html#a10224509
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20070427/b38bdc7c/attachment.htm>
More information about the opencms-dev
mailing list