velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kishore Senji <kse...@gmail.com>
Subject Re: Class cast issue?
Date Tue, 03 Aug 2004 15:21:53 GMT
Please make sure that the method enumCode exists in the Object that
$obj refers to.

On Tue, 3 Aug 2004 19:09:48 +0900, Matthew Van Horn
<matthew@ashleyassociates.co.jp> wrote:
> I have a typesafe enum class with methods:
> 
>    public final Serializable getEnumCode() {
>        return enumCode;
>    }
> 
>    public String toString() {
>        return name;
>    }
> 
> I put a number of these objects into a SortedSet, and in my template I
> try:
> 
> #foreach($obj in $objSet)
> <option value="$obj.enumCode">$obj</option>
> #end
> 
> This outputs:
> 
> <option value="$obj.enumCode">Foo</option>
> <option value="$obj.enumCode">Bar</option>
> <option value="$obj.enumCode">Baz</option>
> 
> I have tried :
> <option value="$obj.getEnumCode()">
> And
> <option value="$obj.getEnumCode().toString()">
> 
> But none of them seem to return a value.
> 
> Does it have anything to do with the fact that the method returns
> Serializable? How can I get it to do the obvious?
> 
> Thanks,
> Matt
> 
> ---------------------------------------------------------------------
> 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