velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barbara Baughman <>
Subject Re: redirect Velocity
Date Fri, 09 Jan 2004 16:42:21 GMT
If you are wanting to use one Velocity template instead of another,
the best way is to include the code in your java servlet.

if (condition) template="valid.vm";
else template="invalid.vm";
Then process the template through Velocity.

If you have to do this with Velocity, you can send the Velocity
context to a general template with the code:

#if (condition)

This assumes that you have something in the context that lets you test
for the condition as well as containing the information needed for
valid.vm or invalid.vm.

If you are asking if Velocity can redirect to an entirely different
template (starting over) in the middle of the current template, the

Barbara Baughman

On Fri, 9 Jan 2004, Giuliano wrote:

> I need to solve a doubt
> thank you!
> i would like to know , what i need to do to redirect a page using Velocity.
> ex:
> if i get a invalid session i want to redirect to another file.vm
> how can i do this???
> thank you!!
>       Giuliano Yoshinaga Bisse
>       Unopar - Coordenadoria de Informática
>       Programador de Sistemas
>       Visite nosso Portal:
>      (43) 3371-7755
>       "Tudo posso Naquele que me fortalece"

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message