Indeed this seems to be the best solution to the common text formatting
problem...

 <ww:property value="formateDate(startDate,'dd MMM yyyy')"/>

Thanks.

But it does point out that the current type conversion scheme is very
limited as a text formatting mechanism.   Property based format
configuration is adequate for text input (ie from html forms) but an
approach similar to the code above is necessary for output (ie into the
view).  Maybe it would be better to not use this TypeConverter functionality
for the textual output of to views.

The TypeConverter approach does not allow for the different types of
formatting that may be required in a view.  For example, to output a date as
both a time part and a date part or to shorten a long description String
into an short abstract.  For these types of formatting issues maybe a new
"formatting" API should be created that can be controlled at the view level
directly with tags.

But for now I will roll my own text formatting like the above.

John


----- Original Message ----- 
From: "Francisco Hernandez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 01, 2003 8:10 PM
Subject: Re: [OS-webwork] Type conversion


> I would probably just put a formatDate() method in my BaseAction class
> and use something like:
>
> <ww:property value="formateDate(startDate,'dd MMM yyyy')"/>
>
>
> John Patterson wrote:
> > What is happening with the type conversion functionality?  I need to be
> > able to override the conversion both to and from string easily.
> > xwork-conversion.properties only allows me to specify one way.
> >
> > Is there any plans to allow you to configure a converter seperatly for
> > each property?  For example, I have several dates which appear on a page
> > in different formats.  It would be great to be able to specify in
> > xwork.xml the format to be used for each property.  Or would this be
> > best handled in a tag lib (to presentation specific)?
> >
> > Maybe if the PropertyTag had a format attribute which was somehow passed
> > to the TypeConverter...
> >
> > <ww:property value="startDate" format="dd MMM yyyy"/>
> >
> > ...or something like that.
> >
> > John.
>
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
>


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to