This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes response.sendRedirect();jsp:forward;<c:redirect> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "response.sendRedirect();jsp:forward;<c:redirect>" Watch "response.sendRedirect();jsp:forward;<c:redirect>" New topic
Author

response.sendRedirect();jsp:forward;<c:redirect>

Balaji Bang
Ranch Hand

Joined: Apr 23, 2007
Posts: 182

Hi

In my jsp I want to forward the request to some other jsp based on a session attribute.

and bothe jsps are in same folder under webcontent. I am using Struts tiles.

I tried with "/index.jsp" and "./index.jsp" and "MyApp/index.jsp" and

Nothing is working


Please help me ...
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9405
    
  20

Is there any content before this redirect?? If the response is committed before you redirect, you'll get this behavior...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Balaji Bang
Ranch Hand

Joined: Apr 23, 2007
Posts: 182

Before that I have Page imports ,

How to handle these kind of situations???
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9405
    
  20

Generally you should not face a situation where you have to redirect from a JSP. This means that you are putting logic into the JSP, which is not a very good idea. Anyways if you are just doing this for practice, move the logic above any content that you are generating instead of after the head tag...
 
Have you checked out Aspose?
 
subject: response.sendRedirect();jsp:forward;<c:redirect>
 
jQuery in Action, 3rd edition