struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deadman, Hal" <>
Subject RE: bean:write format attribute changes bean:write default behavior
Date Thu, 06 Dec 2001 15:03:28 GMT
This is from an off-list email between Oleg and I:

>From Oleg to me:
Hello Hal,

Default format strings can be written as -
org.apache.struts.taglib.bean.format.timestamp=hh 'o''clock' a, zzzz, MMM d, ''yy
org.apache.struts.taglib.bean.format.time=h:mm a

values for resource file entries are standart Java format strings for
date, time and number values.

>From me to Oleg:
That makes more sense. For some reason the bean:write documentation didn't
make that clear to me. I think the doc should definately contain those

Couldn't you make the behaviour so that if the format task isn't used, and
the key is not found in the resource file, no formating will take place?
That would acheive backwards compatability. If someone wants automatic
formating without using the format attribute of the bean:write tag then they
just have to add the entries to the resource file.

I often used bean:write to print out things that aren't meant to be seen
such as when I print out a number for the body of a multi-box tag. That will
break something if the default is to format the number with commas or
periods depending on your locale.

-----Original Message-----
From: Will Jaynes []
Sent: Thursday, December 06, 2001 9:43 AM
To: Struts Developers List; Oleg V Alexeev
Subject: Re: bean:write format attribute changes bean:write default

I'm sorry, but I'm not at all clear as to what you are saying here. Could
please restate it?

----- Original Message -----
From: "Oleg V Alexeev" <>
To: "Struts Developers List" <>; "Deadman, Hal"
Sent: Wednesday, December 05, 2001 8:50 AM
Subject: Re: bean:write format attribute changes bean:write default behavior

> Hello Hal,
> You can add to application resources strings with default format
> strings for such types as (first string - key for resources, nested
> strings is list of datatypes) -
>      java.lang.Byte, java.lang.Short, java.lang.Integer,
>      java.lang.Long, java.math.BigInteger
> org.apache.struts.taglib.bean.format.float
>      java.lang.Float, java.lang.Double, java.math.BigDecimal
> org.apache.struts.taglib.bean.format.timestamp
>      java.sql.Timestamp
>      java.sql.Date
> org.apache.struts.taglib.bean.format.time
>      java.sql.Time
> Tuesday, December 04, 2001, 5:07:56 AM, you wrote:
> DH> I have some code that uses bean:write and the datetime:format tag from
> DH> taglibs project. I use it like this:
> DH> <datetime:format pattern="MM/dd/yyyy"><bean:write name="contractinfo"
> DH> property="beginDate.time"/></datetime:format>
> DH> The bean:write used to print out the number of milliseconds returned
> DH> getBeginDate().getTime().
> DH> I got a nightly build and now the bean:write prints the number of
> DH> milliseconds with commas which is breaking the datetime:format tag.
> DH> Shouldn't the default behavior for bean:write stay the same if I am
> DH> using the format attribute? I just want to let everyone know that the
> DH> attribute as added will break some existing code that is out there. At
> DH> very least it should be added as a potential gotcha to the release
> DH> Struts 1.1.
> DH> I think the format attribute is a good thing and I wouldn't mind not
> DH> datetime:format because my current technique is painful when the date
> DH> null.
> DH> Thanks, Hal
> DH> --
> DH> To unsubscribe, e-mail:
> DH> For additional commands, e-mail:
> --
> Best regards,
>  Oleg                  
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message