[opencms-dev] create my own view

Jonathan Woods jonathan.woods at scintillance.com
Wed Feb 15 21:28:44 CET 2006


Marcello -
 
You can use OpenCms to host JSPs (either as JSP content, or as content based
on a JSP template), and they'll therefore have access not only to any
OpenCms-specific functionality and content but also to any functionality you
create yourself.  You can include real Java (in <%    %> delimiters) and
invoke third party taglibs or your own Java classes.
 
Architecturally, the best approach would be to keep JDBC stuff out of JSPs
and slap it in your own Java classes, writing them to present a useful
interface to your JSPs.  I imagine some people have even integrated OpenCms
with an object persistence framework like Hibernate, but you need not be so
sophisticated.
 
Your own Java classes can be made available in a variety of ways.  Clearly
they've got to be in a classpath accessible to the JSPs in which you import
them.  If you're intending to bundle up your development into an OpenCms
module, then this means putting them in the template's 'lib' folder (as a
Jar) or 'class' folder (as bare classes); or you can put them in the
OpenCms-wide classpath, <opencms home>/WEB-INF/classes.  This last approach
is quite a good one for quickly developing stuff, because it means you don't
have to bundle things up as a module intil you've finished development; the
downside of all this is that you may have to restart OpenCms to pick up new
versions of any of your classes which it has already loaded.
 
As for database access via JDBC, I'm not sure of the best strategy.  OpenCms
maintains a pool of connections, and you should probably make use of this -
i.e. you should probably use OpenCms code to get access to a JDBC
Connection.  I haven't yet thought about this, but maybe someone else on the
list can give some good advice.  As for where the data should sit, my
current feeling (without much thought behind it) is that you should use the
same database instance (named 'opencms' by default) to host your own tables
etc, because that probably makes things like backup easier - but don't
forget that they won't be accessible to OpenCms admin functionality.
 
Jon

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Villani Marcello
Sent: 15 February 2006 13:44
To: The OpenCms mailing list
Subject: [opencms-dev] create my own view



Hi All,

As I have an existing (and complex), database schema, I can't use the
opencms database to store my contents. So I was thinking to use opencms in
conjunction with jdbc to manage it.

The problem I have now is that I don't know how to build my own view to
handle my contents!

To be clearer: I'd like to have a view that I can personalize as much as I
want. Is it possible? How can I build it?

 

Regards,

Marcello

  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060215/5969fd73/attachment.htm>


More information about the opencms-dev mailing list