On May 29, 2005, at 2:04 PM, Jamie Orchard-Hays wrote:

Yeah, I'd forgotten that. I'm sure it's why we put these in our Visit class.

The idea (in the Darden design) to use a hard-coded data format, but in a Visit-centric way so that in the future if you wanted to provide Locale-specific handling it could be done on a per-Visit basis.

    Erik



Jamie


On May 27, 2005, at 5:03 PM, [EMAIL PROTECTED] wrote:


SimpleDateFormat is not thread safe. You will get weird behavior under
high concurrency.

It cannot be static in the Global, you do have the following options:

1) make the pattern static in Global, and do a new SimpleDateFormat for
each get.

2) make the SimpleDateFormat static in Visit, since you can be assured for the most part that it will not be accessed by multiple threads at once.

Ben


Thanks - worked like a charm.

Patrick

Jamie Orchard-Hays wrote:


You could put your format strings in your Visit or Global object:


private static final SimpleDateFormat SHORT_DATETIME_FORMAT = new
SimpleDateFormat("MM/dd/yy h:mm a");
private static final SimpleDateFormat DEADLINE_DATETIME_FORMAT = new
SimpleDateFormat("EEEE, MMMM d, yyyy @ h:mm a");

Then make getters so your ognl reference isn't hideously long:
public Format getShortDatetimeFormat(){
   return SHORT_DATETIME_FORMAT;
}
public Format getDeadlineDatetimeFormat() {
    return DEADLINE_DATETIME_FORMAT;
}

and then use them in your ognl expression:

<component id="jobResumeDeadline" type="common:Write">
    <binding name="value" expression="job.resumeDueDate"/>
<binding name="format" expression="visit.deadlineDatetimeFormat"/>
</component>

(common:Write) is our own customized version of Insert)

Patrick Kelly wrote:


I have a date originally set as "new
java.sql.Timestamp(time.getTime()" to my DB. I retrieve the data in string format such as "2005-05-13 12:10:57.0" and I am able to bind it with no problem. However, I need to format the date such as "MMM dd, yy, HH:mm:ss" in the binding of a table model. I would rather do
the formatting within the .page file than in a .java file.

Any help would be appreciated,
Thanks - Patrick


------------------------------------------------------------------ --- To unsubscribe, e-mail: tapestry-user- [EMAIL PROTECTED] For additional commands, e-mail: tapestry-user- [EMAIL PROTECTED]




------------------------------------------------------------------- -- To unsubscribe, e-mail: tapestry-user- [EMAIL PROTECTED] For additional commands, e-mail: tapestry-user- [EMAIL PROTECTED]



--
Patrick Kelly
E-Learning Consultant
Learning Commons, University of Calgary
http://commons.ucalgary.ca
Phone: 220-2547


-------------------------------------------------------------------- -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: tapestry-user- [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: tapestry-user- [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to