• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why should HttpServletResponse.sendRedirect lead to a blank page?

 
Sindhu java
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I found some hints from the below post but still i am not sure how to fix the issue
http://www.coderhanch.com/t/554960/JSF/java/Issues-HttpServletResponse-sendRedirect-JSP-JSF


Could you please let me know how this was fixed ?

Below is the Code snippet. - In one of the flows there is a ServletException and so as per the logic it should redirect me to the Logout page however it leads me to a BLANK PAGE.
The url also doesnt change.

try
{
filterChain.doFilter(request, response);
}
catch(ViewExpiredException e)
{
HttpServletResponse httpServletResponse = (HttpServletResponse)response;
httpServletResponse.sendRedirect("authentication/LogoutServlet");
}
catch(ServletException e)
{
HttpServletResponse httpServletResponse = (HttpServletResponse)response;
httpServletResponse.sendRedirect(httpServletResponse.encodeRedirectURL(httpServletRequest.getContextPath()+"/logout.jsp")); //------This doesnt work- i just get a BLANK PAGE.

}

Many Thanks.

Thanks and Regards,
Sindhu
 
Sindhu java
Greenhorn
Posts: 2
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does a View Source in the browser show? A blank page? Bad HTML? Does the page display correctly when the URL is typed into the browser by hand?
 
abani patra
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In response.sendRedirect do not use context path.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Incorrect. In a redirect, the context path must be used.t
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic