You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Kishore Senji <ks...@gmail.com> on 2004/08/03 17:21:53 UTC
Re: Class cast issue?
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
<ma...@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