| Author |
Question about redirecting.
|
Otto Teixeira
Greenhorn
Joined: Aug 10, 2005
Posts: 12
|
|
Hello, According to HFSJ, I should get an IllegalStateException if I try to redirect or dispatch the request AFTER writing to the response. The problem is that isn't happening. Why not? In any servlet's doPost(): The sendRedirect() is simply ignored. If I comment the flush() line, it gets redirected, but still without the exception. Thank you.
|
 |
Narendra Dhande
Ranch Hand
Joined: Dec 04, 2004
Posts: 950
|
|
Hi,
The sendRedirect() is simply ignored. If I comment the flush() line, it gets redirected, but still without the exception.
After the flush(), the server surly throw the exception, bu as the response is commited it will not display in your browser. Check your server log. It should printed there. Without flush, though you are writing to the response writer, the response is not commited ( as thers is some buffering for the writer), the serdRedirect will work without any exception. Thanks
|
Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
|
 |
Otto Teixeira
Greenhorn
Joined: Aug 10, 2005
Posts: 12
|
|
You're right.
I was thinking about something like that... the exception being "hidden" by the container. Thank you.
|
 |
 |
|
|
subject: Question about redirecting.
|
|
|