File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
    Bookmark Topic Watch Topic
  • New Topic

request is not forwarding..help me out

 
Vijay Kumar
Ranch Hand
Posts: 260
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi all
I have a saved some value in session like connection object at the time of login.. but after visiting some time I logout and now my session has been invalidate then the resquset should be forwarded to the relogin page... if check it in the following manner..
if(session.getValue("ISEXPIRED")==null){
System.out.println("Forwarding request....");
res.sendRedirect("relogin.jsp?param=close");
System.out.println("It should not be printed...");
}
but instead of forwarding request requset the message "It should not be printed..." is get printed..
plz sugeste me ...


thankx
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
do a requestDispatcher.sendForward() instead.
sendRedirect does not take immediate effect. It will tell the browser to submit a new request for the redirection resource AFTER the service method of the servlet returns.
In other words, you need to place a return statement after a redirection to force the servlet to complete the response.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello,

Is there any sendForward() method is RequestDispatcher Interface. I think it should be forward(..).

Thanks
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
yes, my brain wasn't yet fully awake
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
if(session.getValue("ISEXPIRED")==null){

Also, getValue has been deprecated, use getAttribute instead.
[ February 02, 2005: Message edited by: Ben Souther ]
 
Vijay Kumar
Ranch Hand
Posts: 260
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
THANKS ALL OF YOU..
I HAVE USED requestDispatcher AND NOW ITS WORKING FINE...
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic