This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes HttpServletResponse.sendError(): need redirect to error page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpServletResponse.sendError(): need redirect to error page" Watch "HttpServletResponse.sendError(): need redirect to error page" New topic
Author

HttpServletResponse.sendError(): need redirect to error page

Davin Austin
Greenhorn

Joined: Mar 10, 2013
Posts: 2
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

Joined: Jan 10, 2002
Posts: 60806
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Davin Austin
Greenhorn

Joined: Mar 10, 2013
Posts: 2
Thanks. I just thought that it is better approach to display error page address.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60806
    
  65

Why? That's not the page that was requested. What advantage would there to be to displaying the URL of an error page?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpServletResponse.sendError(): need redirect to error page
 
Similar Threads
Tomcat broken link
HttpUnit- Error on HTTP request: 503 Service
custom 503 error page thrown from servlet java
Individual Tomcat 503 error-page
Apache Refusing connections while uploading/Downloading files