Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sendError(int) vs setStatus(int)

 
Puneet Vashisht
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guyz,

to me both sendError(int) and setStatus(int) appear to do the same things. Is there any diff b/w in view of what client sees on the browser.

thankz,
puneet
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In case of sendError method the container built a error page and sent to the browser ( Some browser may take there own action). In case of setStatus the container sent only code and the browser take appropriate action, that is, the default container error machanism is not clalled.

But if you define the <error-page> for particular code, then the page is called in case for both the method.

The sendError one extra overloaded version which take Status code and message string as argument.

Hope this help

Thanks
 
Puneet Vashisht
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankz dude, its very much clear now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic