[opencms-dev] How to access own Java Class via JSP in OpenCMS 5 RC2

ambiesense at gmx.de ambiesense at gmx.de
Thu Apr 3 20:07:32 CEST 2003


Hello,

thanks for your quick answer :) This sounds good. I have had a look to the
usebean Tag. However this bean need to get access to the OpenCMS instance.
This seems to be a problem. I have used that code before triggered by a content
template. Every time a website, made from this OpenCMS content template, was
accessed. My class overwrites that method:

public byte[] getContent(CmsObject cms, String templateFile, String
elementName, 
                             Hashtable parameters, String templateSelector)
throws CmsException {

so I got access to CmsObject. With this CmsObject I could access i.e. Files
in the VFS or users in OpenCMS. 

How can I do this with the JSP approach?

Any help would be highly appreciated!

Cheers,
Ralf

> Hi,
> 
> this is no problem. You just have to make sure that the OpenCMS webapp
> is seeing your class. Either put it into the  opencms.jar or under
> WEB-INF/classes. If you just want to use the class as a bean you can use
> the "useBean" - Tag. For that you don't need to write your own tags.
> 
> --Marcus
> 
> > -----Original Message-----
> > From: opencms-dev-owner at www.opencms.org 
> > [mailto:opencms-dev-owner at www.opencms.org] On Behalf Of 
> > ambiesense at gmx.de
> > Sent: Thursday, April 03, 2003 6:23 PM
> > To: opencms-dev at www.opencms.org
> > Subject: [opencms-dev] How to access own Java Class via JSP 
> > in OpenCMS 5 RC2
> > 
> > 
> > Hi,
> > 
> > I followed the advice of Tim Howland and want to use JSP and 
> > JSTL for dynamic page generation. I am planning to develop an 
> > Hello World example:
> > 
> > I want to have a JSP page with a very basic form (textfield 
> > and submit button).  The user enters his name  in the 
> > textfield (i.e. Bob) and press the submit button. The word 
> > get somehow transported to another JSP page which calles a 
> > method in my own Java class with the word as parameter. The 
> > Java class simply returns the input (Echo method). This 
> > result should be displayed in this JSP so it finally produces 
> > the output: "Hello World Bob".
> > 
> > Is this generally possible? Will I need to develop my own TLD 
> > file declaring the tags I want to be able to use? Does 
> > somebody has already developed some JSP which access a own 
> > (non-OpenCMS) Java class (i.e. a Java Bean) ?
> > 
> > Thanks in advance,
> > Ralf 
> > 
> > -- 
> > +++ GMX - Mail, Messaging & more  http://www.gmx.net +++
> > Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!
> > 
> > 
> 
> 

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!




More information about the opencms-dev mailing list