• Post Reply Bookmark Topic Watch Topic
  • New Topic

response.sendRedirect and IllegalStateException  RSS feed

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Will the response.sendRedirect to a JSP Page will result will result in a IllegalStateException like a forward if the response is already commited??
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about it.

A redirect is done with response headers.

You cant modify the response headers if they have already been sent.

When in doubt, read the JavaDocs for HttpServletResponse

Bill
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

As per the docs it says that try to use response.isCommited() before doing this action.

Anyway Thanks Bill.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!