• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp:forward action (was Static and dynamic inclusion in jsp)  RSS feed

 
bhushan kumarsel
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<jsp:forward page="other.jsp" />

if the output is buffered, it is first cleared, and then the request
forwarded to the other resource. However, if the output is not buffered and/or if the
response is already committed by the forwarding resource, then a java.lang.IllegalStateException
is raised when we attempt to forward the request.

"i am not getting meaning of the above statement.can anyone pls explain me this.
bh


[BPSouther: changed subject line to match question]
[ July 25, 2007: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"bh se",
Welcome to JavaRanch!

We're pleased to have you here with us here on the ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. You can change it here
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a link to the JSP spec in my signature.
If you search it for the words 'buffered' and 'autoFlush' you should be able to get a good understanding of buffering in JSP pages.

In a nutshell, with an unbuffered page any of your output will go straight to the browser as it is written.
In this case, you have to be careful to send things in the correct order. For instance, you wouldn't be able to start sending body content (HTML, CSS, Javascript) to the browser and then try to send a redirection header (which has to come before the body).

Since forwarding to another page will result in a new set of HTTP headers to be written, the JSPs either need to be buffered, so the older stuff can be discarded instead of being sent to the browser OR if it isn't buffered and stuff may have already been sent, it needs to blow up because it would be impossible to render a new page correctly. It does so by throwing an IllegalStateException.
 
praveen sharma
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi bhushan kumarsel

I am sorry i am not able to get you.so can you please help me again what's yours problem.i am asking because i am new in servlet & jsp.but want to try in order to rectify your problem.so if possible can you eleborate problem you are facing.

Thanks
Praveen
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!