aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ out.write() jsp:forward 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 "HFSJ out.write() jsp:forward" Watch "HFSJ out.write() jsp:forward" New topic
Author

HFSJ out.write() jsp:forward

lars carlsson
Greenhorn

Joined: Sep 04, 2008
Posts: 4
Hi
On page 416 it say that you can�t use out.flush() and then make a <jsp:forward page= />. Can you make a out.write() and then <jsp:forward page= /> ?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by lars carlsson:
Hi
On page 416 it say that you can�t use out.flush() and then make a <jsp:forward page= />. Can you make a out.write() and then <jsp:forward page= /> ?


What you get at the time of execution?
Surajsingh Thakur
Ranch Hand

Joined: Sep 09, 2008
Posts: 124

Originally posted by lars carlsson:
Hi
On page 416 it say that you can�t use out.flush() and then make a <jsp:forward page= />. Can you make a out.write() and then <jsp:forward page= /> ?


I think no..please see the first Mock question of this chapter...Correct me,if wrong


BE (Computer Science) SCJP 4 (80%) SCWCD 5 (97%) IBM CAD(98%) IBM CAppD(100%) IBM SD(100%)
Shruthi Sam
Ranch Hand

Joined: Jul 09, 2008
Posts: 73
If you use out.write("") and then <jsp:forward /> , i think it will work. please correct me if am wrong
Victor Dolirio
Ranch Hand

Joined: Aug 21, 2008
Posts: 57
yes, you can do it, but remember... when you forward the request you�re saying that you aren�t responsible to the result of response, in this case, assuming you don�t called the out.flush(), the container will clear all buffered data in out object before it forward the request.


If happen something bad in you life, don't ask God why it happened. Ask for what.
SCJP 5 (80%) - SCWCD 5 (91%) - SCBCD & SCJD coming soon...
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Its guaranteed that if you flush the buffer and then do a forward you will get a IllegalStateException.
out.flush();
<jsp:forward page="x.jsp"/>

However if you do
out.write("x");
<jsp:forward page="x.jsp"/>
Then you might not get exception because here all the data will be stored in the buffer and will not be flushed unless it fills up.
Default buffer size is 8kb and autoFlush attribute of page directlive is true.
Hence if you have 8kb of data before jsp:forward then container will flush it automatically and hence there is a possiblity that you can get exception out.write("x");
<jsp:forward page="x.jsp"/>

I hope am correct.


SCJP, SCWCD, SCBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFSJ out.write() jsp:forward