Meaningless Drivel is fun!
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp forward doubt? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "jsp forward doubt?" Watch "jsp forward doubt?" New topic

jsp forward doubt?

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032


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

If you try to do any of the above, you�ll get an IllegalStateException.

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Saurabh Kumar
Ranch Hand

Joined: Aug 21, 2006
Posts: 56
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,
Yasser Almohammad

Joined: Feb 11, 2007
Posts: 12
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 Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032


I got to understand this. Thanks!
I agree. Here's the link:
subject: jsp forward doubt?
It's not a secret anymore!