This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Tomcat and the fly likes response.sendRedirect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "response.sendRedirect" Watch "response.sendRedirect" New topic
Author

response.sendRedirect

Prem Khan
Ranch Hand

Joined: May 30, 2005
Posts: 189
This is weird this code will not redirect the if statment becomes true and prints to the log but the page does not redirect ? I would apreciate any help on this... thanks

<% if (session.isNew()) {
System.out.println("isNew == true ... TRYING TO REDIRECT");
response.sendRedirect("/IRIS/index.jsp");
}

System.out.println(session.getAttribute("FirstPageViewed") + "11221" );

if (session.getAttribute("FirstPageViewed") == null){
System.out.println("FIRST PAGE VIEWED == NULL ... TRYING TO REDIRECT");
response.sendRedirect("/IRIS/index.jsp");
}
%>
Prem Khan
Ranch Hand

Joined: May 30, 2005
Posts: 189
Well it looks like I solved this myself, but for anyone else haveing this probblems...

The page accually was redirecting, but still showed the content that was supposed to be pushed to the browser.

All I did to fix it was

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: response.sendRedirect