Hi !
>Hello,
>I have one servlet class file that basically
>establishes a connection to the database, verifies
>the username and password and depending on his
>permissions, a list of options are displayed. Now
>when a user clicks on one of the options, another
>servlet is called. Can I use the connection
>established in the login class in this new servlet
>that is going to be called ?
>Appreciate it for any help.
>Thanks,
>J
This problem is a little bit complicatied.
There are 2 possibilities (I think):
The first one is to use the same Servlet that established
the database connection in the init() method i think.
You could use either a hidden filed with a value= 1 or page1
and than check this value so you can realize that the user
is already connected .
The second one is to save the Conection in a session.
I don't know if this works or no I haven't tried it out.
Like this
In the first servlet
Session s=request.getSession(false);
s.putValue("conection",connection);
And in the second one
Session s=request.getSession(false);
Connection c=(Connection)s.getValue( "conection");
Please see the help pages available about using a Session and
his methods.
___________________________________________________________________________
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