I have the following in the Base-Class for my pages:

public class MyBasePage extends BasePage
private Format _dateFormat;

        public Format getDateFormat() {
            if (_dateFormat == null)
              _dateFormat = new SimpleDateFormat("dd MMM yyyy");

            return _dateFormat;
        }


You need not worry about synchronisation issues since Tap-Pages are only
used by one thread at a time. You could problable also inject Bean if you're
fond of fancy notations.

hth, Marcus

> -----Original Message-----
> From: Adrian Davis [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 08, 2006 10:09 PM
> To: 'Tapestry users'
> Subject: RE: Date format
> 
> 
> I'm still new at this, and I have to admit I'm a little 
> confused at the
> difference between a bean and a service.  Are you talking about a
> synchronized bean of some sort that I could reference in the format
> attribute of the @Insert?
> 
> - Adrian
> 
> -----Original Message-----
> From: Hensley, Richard [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, February 08, 2006 11:53 AM
> To: Tapestry users
> Subject: RE: Date format
> 
> If you are using the JDK date formatters, you don't use one 
> object because
> they are not thread safe. You create them as you go.
> 
> As an alternative, you might create a date formatting service 
> that you can
> inject to all your pages and use. This could be threaded to 
> deal with the
> date format thread safety issues.
> 
> 
> Richard
> -----Original Message-----
> From: Adrian Davis [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 08, 2006 8:30 AM
> To: Tapestry users
> Subject: Date format
> 
> I'd like to create a particular dateformat once object and 
> use it throughout
> my application without adding it to every page.  What's the 
> best way to do
> this?
> 
> - Adrian
> 
> 
> ---------------------------------------------------------------------
> 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]
> 

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

Reply via email to