• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

why should HttpServletResponse.sendRedirect lead to a blank page?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was referring to the below link

https://coderanch.com/t/554960/JSF/java/Issues-HttpServletResponse-sendRedirect-JSP-JSF#2517867
 
Sheriff
Posts: 67537
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In response.sendRedirect do not use context path.
 
Bear Bibeault
Sheriff
Posts: 67537
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Incorrect. In a redirect, the context path must be used.t
 
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic