Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

response.write don't work after using forward

 
Riadh Haouari
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm preparing the SCWCD certification , and i've seen an example which i havn't understood here is:
I have a ServletA which forward to a ServletB
in servletA after forward statement i have a response.getWriter().write("BlaaaaaBla").
when ServletA is given back control "response.getWriter().write("BlaaaaaBla")." is executed but nothing is shown in the web page.
Does anyone has an explication to this case ?! and what is the real differences between include and forward?
Thanks for your reply
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before your forward method finishes, the container flushes closes the writer.
Probably you get an error but it's too late to send an error to the browser. Check your application server logs.
 
Riadh Haouari
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank's for your reply , i checked the server log's but no exception or error is there . Giving your explication, the writer is closed when the control is given back to servletA , because i have some response.getWriter().write() in ServletB and it's shown in the web page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic