velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claude Brisson <cla...@renegat.net>
Subject Re: Server-side redirect from VelocityTools?
Date Wed, 25 Jun 2008 16:54:49 GMT
Hi.

My strategy about redirects is to map the templates that need them to an
ActionServlet that overload VVS.mergeTemplate to use a string buffer.

I then define some macros :

#macro(forward $url)
  $request.session.servletContext.getRequestDispatcher($url).forward($request,$response)
#end

#macro(redirect $url)
  $response.sendRedirect($url)
#end



  Claude

Le mardi 24 juin 2008 à 16:13 -0600, White, Tim a écrit :
> Hi -
>  
>  I'm pretty sure that since the response is already set by the time that
> a .vm template is running via VelocityViewServlet, that you can't do a
> server-side redirect at that point.
>  
>  Is that true, or is there a way to forward to a different page directly
> from logic in a .vm w/o JavaScript?
>  
>  For example:
>  
>    #if ($myVar == null)
>         #redirect to some other page
>    #end
>  
> Thanks,
>  
> Tim
> 
> 
> This communication is the property of Qwest and may contain confidential or
> privileged information. Unauthorized use of this communication is strictly 
> prohibited and may be unlawful.  If you have received this communication 
> in error, please immediately notify the sender by reply e-mail and destroy 
> all copies of the communication and any attachments.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message