We are using IBMs WebSphere. I am using RequestDispatcher to redirect the servlet to a 
different page/servlet. Code I am using in my
servlet(x.java) is as follows:


        String xyz = request.getParameter("xyz");

if (xyz.equals("one")) {
                RequestDispatcher rd1 = 
getServletContext().getRequestDispatcher(page1.jsp);
                rd1.forward(request, response);
}

                RequestDispatcher rd2 = 
getServletContext().getRequestDispatcher(page2.htm);
                rd2.forward(request, response);


If "xyz" is not "one" page2.htm is displayed. If "xyz" is "one", then page1.jsp is 
displayed and "llegalStateException" error is
thrown below it. I am not sure why it is behaving like this. I believe if "xyz" is 
"one" then control should be transferred to
page1.jsp and code after the if loop should not be executed.

I have tried using servlets in place of page1 and page2. The result is same - code 
upto forward takes the control to the target
servlet and any code after the forward including forward if any, are also executed. If 
there is no code after forward(esp another
forward) then it behaves just fine.

Can anybody throw light on it!

Thanks in advance.

===========================================================================
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