Hi,
By and by speaking, have any of you given a thought to the scope, instance,
of the servlets.
Useing ServletContext to get the object of the other servlet typecasting it,
all the things might still not work, what about the scope of the servlet,
does it keep its variables even after the call has been returned.
making something Final, is it a good idea....
definately if you make something static, will it not affect another user(we
are doing multithreading by default) have you thought of threadsafe
variables.
will it not be easier to just use the much efficient session object.
though you have a good idea of using servletcontext it would become
application specific, i.,e static to the application,
getAttribute & setAttribute
if you want to diffrentiate b/w users, use the session object to make a
varaiable with session scope.
getValue & putvalue
Amit
> -----Original Message-----
> From: Usha Sree Y [SMTP:[EMAIL PROTECTED]]
> Sent: Saturday, December 25, 1999 2:52 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Inter servlet communication
>
> One way of accessing the desired var is:
>
> U can have a method in the first servlet which returns the supposed
> variable.
> In u'r second method servlet,get the 'ServletContext' with the
> getServletContext of the ServletConfig class.Once u get the
> ServletContext class,then get the Servlet with the getServlet(name of
> u'r first Servlet) of the ServletContext class.Cast it to a servlet and
> then u can access the methods of u'r first servlet.If u call the method
> which returns the var then u have access to the var of u'r first
> servlet.
> usha.
> sachin rameshrao zingade wrote:
>
> > Hi I want to pass a variable from one servlet to the other ,how to do
> > this? sachin
>
> __________________________________________________________________________
> _
> 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