Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:forward doubt??

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

Why a <jsp:forward> won't work if there is no buffer?? i.e., when we set the <%@ page buffer="none" %>, and when we have a <jsp:forward> on that page, why is that it dosn't work and we get an IllegalStateException??
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jothi,

Because if there is no buffering every data that is written will be flushed immediately (i.e. the response will be committed 'automatically' after the 1st write operation).

And don't forget that your template data gets written to the response too, so it is practically not possible to avoid writing to the reponse before invoking jsp:forward (for a clear example, take a look at the translated servlet resulting from your jsp and you'll find many '\n' being written to the response).
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok...I got to understand this! Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic