Re: RequestDispatcher.forward() in Tomcat 3.2.1
You are right. Control does return to the calling servlet. It just couldn't write to the response. It would be nice if an exception was thrown. After control returns to the calling servlet, I try forwarding to a second servlet and that doesn't seem to work. The first servlet that was forwarded to did not change the response. Is multiple forward within a servlet not supported/allowed? Bill "Craig R. McClanahan" wrote: William Au wrote: Is there any way in Tomcat 3.2.1 for the control to return to a servlet after its call to RequestDispatcher.forward() is completed? Control *does* return -- RequestDispatcher.forward() is a normal Java method call. However, the servlet spec prohibits you from modifying the response at this point. If Weblogic lets you do this (for instance, by allowing you to add additional text to the response created by the forwarded-to servlet), then it is not obeying the spec. That is the behavior of WebLogic 5.1.0. I want my code to work on the same way running under both. I am aware of the RequestDispatcher.include() method. Bill Craig McClanahan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: RequestDispatcher.forward() in Tomcat 3.2.1
What Craig meant (I believe) by "prohibits you from modifying the response" is that the response has been committed and no more data can be sent. The html/other-data you are sending to the client is part of the response. When the forward returns, you are prohibited by the spec, from adding any more information to the response output stream. If you need to do as you desire, you must use some kind of include based scheme instead of forward. Regards, Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 9:38 AM To: [EMAIL PROTECTED] Subject: Re: RequestDispatcher.forward() in Tomcat 3.2.1 You are right. Control does return to the calling servlet. It just couldn't write to the response. It would be nice if an exception was thrown. After control returns to the calling servlet, I try forwarding to a second servlet and that doesn't seem to work. The first servlet that was forwarded to did not change the response. Is multiple forward within a servlet not supported/allowed? Bill "Craig R. McClanahan" wrote: William Au wrote: Is there any way in Tomcat 3.2.1 for the control to return to a servlet after its call to RequestDispatcher.forward() is completed? Control *does* return -- RequestDispatcher.forward() is a normal Java method call. However, the servlet spec prohibits you from modifying the response at this point. If Weblogic lets you do this (for instance, by allowing you to add additional text to the response created by the forwarded-to servlet), then it is not obeying the spec. That is the behavior of WebLogic 5.1.0. I want my code to work on the same way running under both. I am aware of the RequestDispatcher.include() method. Bill Craig McClanahan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: RequestDispatcher.forward() in Tomcat 3.2.1
William Au wrote: Is there any way in Tomcat 3.2.1 for the control to return to a servlet after its call to RequestDispatcher.forward() is completed? Control *does* return -- RequestDispatcher.forward() is a normal Java method call. However, the servlet spec prohibits you from modifying the response at this point. If Weblogic lets you do this (for instance, by allowing you to add additional text to the response created by the forwarded-to servlet), then it is not obeying the spec. That is the behavior of WebLogic 5.1.0. I want my code to work on the same way running under both. I am aware of the RequestDispatcher.include() method. Bill Craig McClanahan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: RequestDispatcher.forward() in Tomcat 3.2.1
I believe this is the normal behavior. Your servlet should regain control after the forward. At least I know it works when forwarding to JSPs. -Casey -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 15, 2001 3:15 PM To: [EMAIL PROTECTED] Subject: RequestDispatcher.forward() in Tomcat 3.2.1 Is there any way in Tomcat 3.2.1 for the control to return to a servlet after its call to RequestDispatcher.forward() is completed? That is the behavior of WebLogic 5.1.0. I want my code to work on the same way running under both. I am aware of the RequestDispatcher.include() method. Bill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - This email server is running an evaluation copy of the MailShield anti- spam software. Please contact your email administrator if you have any questions about this message. MailShield product info: www.mailshield.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]