• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServletResponse.sendError(): need redirect to error page

 
Davin Austin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code in doFilter() method, where I get application scoped bean.



I mapped 503 code to specific error page in web.xml. And I really get content of error page in browser, if error occurs. But the address in address bar doesn't change for error page address: an address of requested servlet leaves there. Is it right behaviour?
I'd like to inform explicitly about redirection to error page. Is it only possible with sendRedirect() and sendError() is not useful here?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64832
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would it be important that the URL of the error page be displayed? It's not. That's not the page that was requested. The behavior you are seeing is correct.
 
Davin Austin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I just thought that it is better approach to display error page address.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64832
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why? That's not the page that was requested. What advantage would there to be to displaying the URL of an error page?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic