> First of all I will give you some information about my project, my prject
> involves B2B integration between two sites using a third party called
> iMediation. The only part which we have to implement is "Add to Bag".
Lets say
> site1 is primary vendor and site2 is secondary vendor, since both are
having
> B2B relation, site1 allows customer to do shopping of site2 from their
site.
> Initially customer will come to site1 and if he requests a product which
is
> available in site2, then site1 will simply redirect to site2.
I'm assuming that by sites you mean two different applications running on
two different servers? If not then disregard the following -
The simulation may work but this isn't going to work out in the real world -
you can't forward or include across applications (sites as you call them).
The RequestDispatcher will only work between resources within the same
application (i.e. within the same ServletContext), you'll need to use some
other B2B technique to achieve this,
Kevin Jones
DevelopMentor
www.develop.com
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Sushil Singh
> Sent: 14 September 2000 01:01
> To: [EMAIL PROTECTED]
> Subject: Re: RequestDispatcher Function
>
>
> Hi Nic:
>
> Thanks for your reply.
>
> First of all I will give you some information about my project, my prject
> involves B2B integration between two sites using a third party called
> iMediation. The only part which we have to implement is "Add to
> Bag". Lets say
> site1 is primary vendor and site2 is secondary vendor, since both
> are having
> B2B relation, site1 allows customer to do shopping of site2 from
> their site.
>
> Initially customer will come to site1 and if he requests a
> product which is
> available in site2, then site1 will simply redirect to site2.
> There user can
> selects any product and if user clicks "Add to bag", it should
> add that product
> in site1 cart.
> Now my requirment is that, after performing "add to bag", my
> program should
> return to site1 and additonally display a popup window saying
> "This item has
> been added to site1 cart".
> - Site2 will pass the url as parameter which will act as return path.
>
> In order to simulate this, I am having two servlets which will
> perform this
> process, you may assume that servlet1 and servlet are in two different
> domains..
>
> Now your first question:
> >When you say "calls" I presume you mean that:
> > - the submit goes to servlet1
> > - servlet1 gets a RequestDispatcher for servlet2
> > - servlet1 forward()s the request to servlet2
>
> No, when I say "calls", the submit directly calls "Servlet2" since its
> specified in <Form action>.
> Servlet2 is getting RequestDispatcher for Servet1
> Servlet2 forward()s the request to Servlet1
>
> Your second question:
> >1. Before redirecting to servlet 1, servlet 2 should produce
> html which will
> display a popup window.
>
> No, since the control is in servlet2, it should return to servlet1 but
> addionally displays a popup window.
>
> Now regarding forward(), if Servlet2 is forward()s to Servlet1, then what
> should be the url in the browser, I am seeing the url for
> servlet2. This result
> is same for both include() and forward().
>
> Thanks,
>
> Sushil
>
> Nic Ferrier wrote:
>
> > >>> Sushil Singh <[EMAIL PROTECTED]> 13-Sep-00 10:51:14 PM >>>
> >
> > Firstly this is a much better explanation of your problem than the
> > first one. That was confusing and hard to read. Posting in the way
> > you've done here makes it easy for us to help you.
> >
> > >I am having one servlet "Servlet 1" which displays a form,
> > >on form submit, it calls another servlet "Servlet 2" which will do
> > >some process and then redirects to servlet 1 using
> > RequestDispatcher.
> >
> > When you say "calls" I presume you mean that:
> >
> > - the submit goes to servlet1
> > - servlet1 gets a RequestDispatcher for servlet2
> > - servlet1 forward()s the request to servlet2
> >
> > Yes?
> >
> > >1. Before redirecting to servlet 1, servlet 2 should produce
> > >html which will display a popup window.
> >
> > Ok. Why go back to servlet1?
> >
> > >2. Its perfoming perfectly i.e. it redirects to servlet 1 and
> > >display a popup window. The only thing I am unable to
> > >understand is that still the url on browser is Servlet 2, which
> > >I think should be Servlet 1.
> >
> > You'll have to answer the above questions before I can answer that.
> >
> > >This type of scnerio is required when dealing with multiple
> > >websites. Here you can assume that "Servlet 1" is on one
> > >website and "Servlet 2" on another website.
> >
> > I don't understand this.
> >
> > >Also if anyone can provide difference between forward
> > >and include.
> >
> > You could search the archives or FAQs. This has been explained many
> > times.
> >
> > Breifly the answer is this:
> >
> > RD.forward()
> > the whole request is forwarded to the RD target. This is generally
> > used when you want a servlet to do some processing on the request (ie:
> > get a parameter) and forward to different servlets depending on the
> > result.
> >
> > RD.include()
> > includes the output of the servlet that is dispatched to (ie: the
> > servlet that is INCLUDED) in the output of the servlet that called
> > include.
> >
> > so if servlet-A output this:
> >
> > <html>
> > <body>
> > <h1>document title</h1>
> >
> > and then called rd.include() on servlet-B that output this:
> > <p>Hello there!</p>
> >
> > and then servlet-A output this:
> >
> > </body>
> > </html>
> >
> > then you would see this come back to the UA:
> >
> > <html>
> > <body>
> > <h1>document title</h1>
> > <p>Hello there!</p>
> > </body>
> > </html>
> >
> > See?
> >
> > Nic Ferrier
> >
> >
> __________________________________________________________________
> _________
> > 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
___________________________________________________________________________
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