Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Balaji Bang
Ranch Hand
Posts: 182
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any content before this redirect?? If the response is committed before you redirect, you'll get this behavior...
 
Balaji Bang
Ranch Hand
Posts: 182
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before that I have Page imports ,

How to handle these kind of situations???
 
Ankit Garg
Sheriff
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!