velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Mason <and...@miniatureworldmaker.com.au>
Subject Re: Java 5 enum
Date Thu, 29 Dec 2005 23:41:26 GMT
There may be a velocity tool to do this, but it may also be better 
implementing the logic in the java file instead...

ie just include a different String template_name depending on the enum value 
in the back end and #parse("$template_name");


On Thursday 29 December 2005 21:58, Michael Heuer wrote:
> Glenn Holmer wrote:
> > We're considering holding a session variable as a Java 5 "enum", in
> > which case it looks like we'd have to test its toString() value to
> > branch on it in a Velocity template, e.g.
> >
> > #if ($userType.toString() == "salesman")
> >   ## do salesman stuff
> > #elseif ($userType.toString() == "customer")
> >   ## do customer stuff
> > #end
> >
> > Is that the right way to do this in Velocity?
>
> That is what I had to do.
>
> For what it is worth, I received no reply to a similar message I sent to
>
> velocity-user some time ago:
> > http://marc.theaimsgroup.com/?l=velocity-user&m=108455529517154&w=2
>
>    michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org

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


Mime
View raw message