Feature Requests (was: [opencms-dev] how to get CmsResource object for current page?)
Thomas Maerz
thomasmaerz at gmx.de
Tue Jul 19 02:11:54 CEST 2005
Joe Desbonnet <jdesbonnet at gmail.com> writes:
> So I can now add the last modified date to the template with this line:
>
> Page last modified: <%=
> java.util.Date( cms.getCmsObject().readResource(
> cms.getCmsObject().getRequestContext().getUri()
> ).getDateLastModified()
> ) %>
>
> However the API does seem a little contorted to me. I'm calling
> getCmsObject() twice. Is there a cleaner way to do this? A
> getCmsResource() method on the CmsObject would be nice.
You can use save one "getCmsObject" if your "cms" is a CmsJspActionElement
< cms.getCmsObject().getRequestContext().getUri()
---
> cms.getRequestContext().getUri()
Regarding the subject, I'd like to suggest a change to
CmsJspTagContentShow. The class should write its content by default to
"pageContext.getOut()", but pass it's content to the
"PageContext.PAGE_SCOPE" by request to a requested attribute's name.
| <cms:contentshow name="a" attribute="b"/>
| <% String b = ( String ) pageContext.getAttribute( "b", PageContext.PAGE_SCOPE ); %>
This should also render the class "CmsJspTagContentCheck" needless.
Disposing the "PageContext.PAGE_SCOPE"'s is not too hard.
Just don't know too much about Tag Libraries,
but just learned enough considering them hazardous.
Regards,
Thomas
More information about the opencms-dev
mailing list