I think the only work around (it works ) seems to be to set some attribute
in Servlet(A).doPost() like

request.setAttribute("redirect", new Boolean(true) );

and retrieve it at the beginning of Servlet(B).doPost() and call
Servlet(B).doGet().



Scott Evans wrote:
>
>In Servlet A's doPost, you can call doGet (still Servlet A) and then
>forward
>to Servlet B.

Would not work, I agree with Hans.

<Hans Bergsten>

If the target servlet needs to process a POST request, it should implement
the doPost() method. I'm not sure why that seems to be a problem in this
case. There's nothing wrong with a servlet that does the same processing
for GET and POST, e.g. by letting doGet() just call doPost() or vice versa.

</Hans Bergsten>

In my Servlet(B) doGet() constructs a user interface with beans and JSPs and
doPost() does some processing.  What I am trying to do after processing user
request to return to the interface(doGet() ) with a message bean in the
request.

Bulent




>From: "Matthews,Paul" <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: doPost() to doGet() via RequestDispatcher
>Date: Thu, 18 May 2000 16:40:07 +0100
>
>What I guess you want to do is... request.setParameter("method", "get");
>
>but... Sun RFE#4255707 (ie you can't)
>
>JRun allows you to this as it doesn't use HttpRequestServlet, but then
>you're tied. Can't think of any workaround.
>
>Regards, Paul
>
> > -----Original Message-----
> > From: Serbulent Ozturk [mailto:[EMAIL PROTECTED]]
> > Sent: 18 May 2000 16:03
> > To: [EMAIL PROTECTED]
> > Subject: doPost() to doGet() via RequestDispatcher
> >
> >
> > Hi,
> >
> > My Servlet-(A) gets a POST request from a form after
> > processing it I need to
> > pass it to another Servlet-(B) but I need to pass it to
> > Servlet(B)'s doGet()
> > method.  As the original request line was POST, it always invokes
> > Servlet-(B)'s doPost().
> >
> > <PRE>
> > getServletContext().getRequestDispatcher("/servlet/B").include
> > (req, res);
> > <PRE>
> >
> >
> > I guest I can set an attribute in the request in the
> > Servlet-(A) before
> > dispatching and retrieve it at the begginning of Servlet-(B)
> > doPost() and if
> > true call the doGet(), as a work around.
> >
> > However, although I could not fond t in API Socumentation, I
> > think there
> > must/should be a convential way of changing the Method type in the
> > Request-Line dynamically, as it is encapsulated as an object, i.e.
> > HttpServletRequest.
> >
> > Any ideas?
> >
> >
> > Bulent
> > ______________________________________________________________
> > __________
> > Get Your Private, Free E-mail from MSN Hotmail at
>http://www.hotmail.com
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to