I don't know if I'd go too far creating a TypeConverter... Can you
just do something like this -
<s:if test="%{your.boolean.property}">Y</s:if><s:else>N</s:else>
Really, you could probably create a .tag file out of it and reuse it
easier than creating a Type Converter.
-Wes
On Fri, Jan 29, 2010 at 7:48 AM, RogerV <[email protected]> wrote:
>
> Hi
>
> I have a collection of objects, each one contains a boolean flag, and I'm
> displaying these via a JSP as a list via an interator. Struts is converting
> the boolean fields into the strings "true" and "false", I'd like to be able
> to
>
> 1) display them as "Y" and "N"
> 2) convert back to "true" and "false" when the list is returned
> 3) and do it via annotation if possible.
>
> Having read http://struts.apache.org/2.0.11.1/docs/type-conversion.html it
> looks that a custom TypeConvertor is the way to proceed.
>
> Is it possible to create a TypeConvertor that extends the existing Boolean
> convertor to return "Y","N" instead of "true", "false"? Where do I find the
> convertor or is it a "built-in" function? Is it possible to do the override
> via annotation so that I can execute the override where I need it and
> default to the standard convertor where I don't.
>
> Regards
> --
> View this message in context:
> http://old.nabble.com/Boolean-Type-Conversion-tp27371490p27371490.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Wes Wannemacher
Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]