Forums Register Login

About Flush Before Include/forward

+Pie Number of slices to send: Send
Hi
I have a code

case:1 with <jsp:forward>
-------------------------
<%
out.println("Before forward/include");
out.flush();
%>
<jsp:forward page="test.html" />

<%
out.println("After forward/include");
%>

a)Container throws Exception
b)output displayed => Before forward/include.


case2:: <jsp:include>
------

<%
out.println("Before forward/include");
out.flush();
%>
<jsp:include page="test.html" />

<%
out.println("After forward/include");
%>

a)container will not throw exception
b)it will deisplay
Before forward/include
include test.html
After forward/include


It means in <jsp:include> if we commit the response and then we will include then it doesn't make difference.


Please correct me if i'm wrong ???

sanjay
+Pie Number of slices to send: Send
hi sanjay,
if you have already comitted *A* response,
your app is death no ... for... ;-). You are over.
if you deploy your examples:
this is the answer:
IllegalStateException.
commitDeath,
ser
+Pie Number of slices to send: Send
But i think its of

response.sendRedirect(String URL)
and
RequestDispatcher.forward().

but not for
RequestDispatcher.include()
or<jsp:include page="" />

Please correct me if im wrong

Thanx
sanjay
I'm still in control here. LOOK at this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 839 times.
Similar Threads
Regarding out.flush() in <jsp:include> and <jsp:forward>
HFSJ out.write() jsp:forward
dont know this error means?
Illegal State Exception: Ref Page 412 HF Book
Regarding out.flush() in <jsp:include> and <jsp:forward>
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:57:50.