Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

jsp forward doubt?

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ranchers,

What it means by saying,

A <jsp:forward> won�t work if

■ There is no buffer (in a JSP, this can be achieved with a page directive, setting the buffer attribute to �none�), and even one character has been written to the response.
■ The buffer has been explicitly flushed (response.flushBuffer()).
■ The buffer has been automatically flushed on filling up (in a JSP, this will happen by default�see the page directive attribute autoFlush for more
information).

If you try to do any of the above, you�ll get an IllegalStateException.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In all the above 3 conditions, the response would be commited.
So if jsp:forward is used after any of these 3 conditions, it would result in IllegalStateException. So jsp:forward won't work...

Thanks and regards,
Saurabh
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the previous answer was complete.
all three cases commit the response and thus throws IllegalStateException upon forwarding, since the purpose of <jsp:forward> is to transfer the the control to another page after discarding what's written as output in current page.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Satou,

I got to understand this. Thanks!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic