You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vinicius Caldeira Carvalho <vi...@squadra.com.br> on 2005/03/14 17:37:39 UTC
Struts tags and enums
Hello there! I'm using enum types in my app and I'd like to use combine
them with struts tags.
My enum class hierarchy descends to PersistenEnum (the example on hibernate)
a method called getEnumCode() returns a Serializable that represents the
code for that enum :P
So far what I'm doing is:
<%String code = String.valueOf(YesNoEnum.YES.getEnumCode())%>
<html:checkbox value="<%=code%>">
This of course s**** cuz I have to import the enum and also adds
scriptlets to my jsp. So I tried the struts-el using:
value="{YesNoEnum.YES.enumCode}"
not working either.
Anyone has a good experience with that?
Thanks
Vinicius
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts tags and enums
Posted by Nicolas De Loof <ni...@capgemini.com>.
You can use jakarta unstandard taglib to "bind" a variable to the static
fiedl YES
<us:bind var="YES" type="com.mycompany.YesNoEnum" field="YES"/>
<html:checkbox value="${YES.enumCode}">
Nico.
Vinicius Caldeira Carvalho a écrit :
> Hello there! I'm using enum types in my app and I'd like to use
> combine them with struts tags.
> My enum class hierarchy descends to PersistenEnum (the example on
> hibernate)
> a method called getEnumCode() returns a Serializable that represents
> the code for that enum :P
>
> So far what I'm doing is:
>
> <%String code = String.valueOf(YesNoEnum.YES.getEnumCode())%>
> <html:checkbox value="<%=code%>">
>
> This of course s**** cuz I have to import the enum and also adds
> scriptlets to my jsp. So I tried the struts-el using:
> value="{YesNoEnum.YES.enumCode}"
> not working either.
>
> Anyone has a good experience with that?
>
> Thanks
>
> Vinicius
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org