[opencms-dev] Bean exemple
Robert Petermeier
robert2.0 at gmx.de
Tue Apr 11 11:16:55 CEST 2006
Francis schrieb:
> I can find some example in the module of OpenCms but I just want to use
> my Bean to separate Java code from my JSP.
That's very noble of you! This comes from someone who has had to
maintain OpenCms-JSPs with no less than six different languages stuffed
into one document: Java, SQL, JSP EL, Javascript, HTML and XML. Of
course, database resources fetched from OpenCms' connection pool were
not released after being used. Instead the pool was reconfigured to grow
when it's exhausted, which put an end to the annoyances caused by these
pesky exceptions...
But I digress: what exactly is your problem? Writing and using beans
works the same way in OpenCms JSPs as with any JSP. All you need (most
of the time) is an instance of class CmsObject. You get that by
instantiating and initializing a CmsJspActionElement instance (either by
'<jsp:useBean ... />' or scriptlets) and calling getCmsObject() on it.
Just confer the docs.
Regards,
Robert
More information about the opencms-dev
mailing list