This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Why status code cannot be changed during session? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Why status code cannot be changed during session?" Watch "Why status code cannot be changed during session?" New topic
Author

Why status code cannot be changed during session?

Guennadiy VANIN
Ranch Hand

Joined: Aug 30, 2001
Posts: 898
Beginner question:
Originally posted in
[url = http://www.wrox.com/books/1861007701.htm ] Professional SCWCD Sample Chapter, p.89
[/url]
" The isCommitted() method can be used to find out if any output has been returned to the client. If this method returns true then it is too late to set the status and any attempt to do so is ignored"

Does it mean that status cannot be changed during session and then resend? Why?
Dan Jepp
Author
Ranch Hand

Joined: Jul 17, 2001
Posts: 39
Hi,
If the isCommitted() method returns true then the buffer has ben filled and the response has been committed to the client(ie they have the output in their browser!)
Changing the status code would be meaningless at this stage hence the error.
Cheers
Dan


Author <a href="http://www.amazon.com/exec/obidos/tg/detail/-/1861007701/qid=1038470361/sr=1-2/ref=sr_1_2/002-5433093-9410428?v=glance&s=books" target="_blank" rel="nofollow">Professional SCWCD Certification</a>
Guennadiy VANIN
Ranch Hand

Joined: Aug 30, 2001
Posts: 898
Thanks Dan
 
Don't get me started about those stupid light bulbs.
 
subject: Why status code cannot be changed during session?
 
Similar Threads
Professional SCWCD - Sample Chapter Available
Why status code is not buffered?
GOOD BOOKS
This weeks Giveaway
Building HTML Forms from XML schemas?