Re: object management

"Taylor, Kevin" <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
        >> What I want is getting already instantiated objects [instantiated
by Tomcat,
        or by my context, whatever...]
        into my servlet without instantiating objects in my init() method.

Sounds like you want JNDI and Tomcat's startup functionality. I haven't done
this in Tomcat but it should be straightforward to instantiate some classes
on startup of Tomcat and reference them via JNDI. RTM.

>>Another issue: (similar to the one above): I have a result set, can I pass
it through sessions.

You should probably convert your ResultSet to a detached rowset or a
Collection of data transfer objects. Make sure the objects are serializable
and you should be ok. Technically, I believe a java.sql.ResultSet
implementation would be serializable in the http session but that sounds
like a really bad idea since ResultSets represent open database cursors.

--Kevin Taylor
Sr Web Developer

> -----Original Message-----
> From: Munteanu Gabriel [SMTP:[email protected]]
> Sent: Friday, May 16, 2003 10:40 AM
> To:   [email protected]
> Subject:      object management
>
> Hi all.
>
> I want to instantiate a class which deals with the databases.
> The resultant object is held in memory (in RAM) by Tomcat.
>
> I want this object to be available to all web-applications ( or to one
> web-application) - which way you know better.
>
> I searched the documentations, and I tried the tag <resource-ref> and a
> servlet in my web-application will
> access the object by JNDI.
>
> What I want is getting already instantiated objects [instantiated by
> Tomcat,
> or by my context, whatever...]
> into my servlet without instantiating objects in my init() method.
>
> I know that there are many methods to do this.
>
> Another issue: (similar to the one above): I have a result set, can I pass
> it through sessions.
> [I come from php world, and I want to move my applications to servlets].
>
> Thank you in advance.
>
> Gabi
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [email protected] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.