About Question enthuware.jwpv6.2.1148 :

Moderator: admin

Post Reply
RumiJal
Posts: 9
Joined: Wed Jul 12, 2017 10:51 am
Contact:

About Question enthuware.jwpv6.2.1148 :

Post by RumiJal »

So to summarize, by the specification the following will 100% throw an IllegalStateException if the buffer is flushed before the call to the forward() method occurs

Code: Select all

out.println("<html><body>Page 1");     
RequestDispatcher rd = request.getRequestDispatcher("SecondServlet");     rd.forward(request, response);
But in the opposite situation, The specification does not make it clear whether calling out.println() will throw an IllegalStateException if the response has been committed and it will just be ignored.

Code: Select all

RequestDispatcher rd = request.getRequestDispatcher("SecondServlet");     rd.forward(request, response);
out.println("Page 1<body><html>");  // let's say this is flushed automatically because the buffer size is very small :P   

Online
admin
Site Admin
Posts: 10034
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1148 :

Post by admin »

That is correct.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests