• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Issues with HttpServletResponse.sendRedirect to JSP/JSF file

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have this strange issue - I have a servlet that needs to do a redirect to a JSF page after checking some credentials are properly entered in the application.

If I do something like response.sendRedirect("/faces/success.jsp"); - i get 404 NOT found.

If I do something like response.sendRedirect(request.getContextPath() + "/faces/success.jsp"); - i get a BLANK PAGE!

(and by the way I have tried encodeRedirect as well - same thing.

I'm using Weblogic 10.3/JDeveloper 11G/JSP/JSF 1.2

Thanks in advance!
 
nena tamari
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way - i just tried getServletContext().getRequestDispatcher(page).forward(request, response);

AND THIS WORKS - But why doesn't the redirect work? Why does it return a blank page every time?

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Hope you know that in forword we get req and res object but not in case of sendredirect.


 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use as in
 
nena tamari
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I understand that it forwards the reqest and response. However, in this case my page doesn't require the request/response objects from the previous screen. So what gives? Why doesn't it work?

response.sendRedirect(request.getContextPath() + "/faces/success.jsp") - DOES NOT WORK - results in BLANK PAGE.

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where do you put the sendRedirect code? and how do you getting the response object?
 
nena tamari
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I figured out what the problem was - one of my filters had a scenario where it wasn't propagating the filter with a chain.doFilter(....) - it now works!

Thanks for replying
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi nena,

you can refer below link. I was also facing somewhat similar problem. I got the solution which is working proper. might it will help you also...

https://coderanch.com/t/583693/BEA-Weblogic/sendRedirect-request-dispatcher-not-working


Sachin Hadawale
 
This one time, at bandcamp, I had relations with a tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic