Kenia,

There are a few ways to do this and I think you might be interested in
directly manipulating one servlet from another.

For instance, if you're in servlet B, you could first call a method in
servlet A's object (this method would print out the record based on the
booking number) then you could print out the additional information that
B handles.

Use Java's language reflection (this requires you know what method
you're looking for in A):

Servlet serv = context.getServlet("THE_NAME_OF_SERVLET_A");
Method myMethod =
servlet.getClass().getMethod("THE_NAME_OF_SERVLET_As_METHOD",null);
myMethod.invoke(servlet,null);

These methods throw a few exceptions so you'll have to wrap this in a
try/catch block. (I believe 4 of them!)

(By the way, if Servlet A's method takes arguments, you specify those in
the argument list:
        public Object invoke(Object obj, Object[] args)
In the case i showed you, it's null but you would probably need to pass
in the booking number....
That is from the JDK documentation.)

Check the servlet documentation on this as well - there may be other
methods you'd be interested in.

Hope that helps,
--Bill

> Kenia Nimesh wrote:
>
> I am dynamically displaying a record from the database based on the
> user by calling servlet A.
>
> In this record i have a field - booking no. When the user clicks on
> this booking no. I am giving some more details of that booking no. in
> the next page by calling Servlet B .Together with some more details I
> also want to display the existing information  of Servlet A on the
> next page generated by Servlet B.
>
> Is there a way by which servlet  B can communicate to servlet A and
> get the details.
> Presently in Servlet B , I am again firing a query based on the
> booking.no to get the details same as Servlet A
>
> A help on this be appreciated
>
> Nimesh
>
>

--
 ----------------------------------
 Bill Lynch -- [EMAIL PROTECTED]
        University of Iowa
  http://www.cs.uiowa.edu/~bmlynch
 ----------------------------------

___________________________________________________________________________
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

Reply via email to