Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL redirect tag  RSS feed

 
Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to redirect the users to a different page from a JSP page and use syntax below. It does not redirect (URL reamains same)and seems does not disply anything either. URL remains current. How do we do this?

<c:redirect url="dest.jsp">
</c:redirect>

I guess I should not be using <jsp:forward> as that will keep the URL same event though internally page may be redirected?

Thanks
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess is that you are creating an IllegalStateException when you try and redirect. Check your logs for any errors.

SendRedirect requires the server to cancel any output already built up to date, and send a completely different one. If the response has been "flushed" or "committed" it can't do that, as it has already passed the point of no return.

Possible Solutions:
1 - put your c:redirect tag as early as you can on the page. That way there is less chance the buffer will fill up and create an error

2 - Make your buffer larger: <%@ page buffer="32kb" %> and see what happens.

Cheers,
evnafets
 
Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess sendredirect is not the way to go. I want to do this:
Initialize some params and then redirect the page to a different location with param. The users should see that in URL fo changed location. I do that in Javascript but since my page is Meta Data driven so I can not use Jscript, hwo else can I do this?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!