aspose file tools*
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
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: 180
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: 9280
    
  17

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: 180
Before that I have Page imports ,

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

Joined: Aug 03, 2008
Posts: 9280
    
  17

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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: response.sendRedirect();jsp:forward;<c:redirect>
 
Similar Threads
JSTL redirect tag
scwcd doubt on jsp:forward
Handling response.redirect errors in JSP page
some problem with java beans scope attribute?
Forward to different URL and pass parameters