struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deadman, Hal" <hal.dead...@tallan.com>
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.int=######
org.apache.struts.taglib.bean.format.float=######,####
org.apache.struts.taglib.bean.format.timestamp=hh 'o''clock' a, zzzz
org.apache.struts.taglib.bean.format.date=EEE, 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
examples.

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 [mailto:wjaynes@mediaone.net]
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
behavior


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

----- Original Message -----
From: "Oleg V Alexeev" <oalexeev@apache.org>
To: "Struts Developers List" <struts-dev@jakarta.apache.org>; "Deadman, Hal"
<hal.deadman@tallan.com>
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) -
>
> org.apache.struts.taglib.bean.format.int
>      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
>
> org.apache.struts.taglib.bean.format.date
>      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
by
> 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
not
> DH> using the format attribute? I just want to let everyone know that the
format
> DH> attribute as added will break some existing code that is out there. At
the
> DH> very least it should be added as a potential gotcha to the release
notes
for
> DH> Struts 1.1.
>
> DH> I think the format attribute is a good thing and I wouldn't mind not
using
> DH> datetime:format because my current technique is painful when the date
is
> DH> null.
>
> DH> Thanks, Hal
>
> DH> --
> DH> To unsubscribe, e-mail:
<mailto:struts-dev-unsubscribe@jakarta.apache.org>
> DH> For additional commands, e-mail:
<mailto:struts-dev-help@jakarta.apache.org>
>
>
>
> --
> Best regards,
>  Oleg                            mailto:oalexeev@apache.org
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-dev-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message