You can use JSTL or write your own Date formatter Custom Tag.
Here is a method that does that:
   public int doStartTag() throws JspException
   {
      Date today = new Date();
      ServletRequest request
         (ServletRequest)pageContext.getRequest();
      Locale user = request.getLocale();
      DateFormat dateFormatter =
         DateFormat.getDateInstance(DateFormat.DEFAULT, user);
      String now = dateFormatter.format(today);

      try { pageContext.getOut().write(now);
      }catch(java.io.IOException ex)
      { throw new JspException(ex.getMessage()); }
      return EVAL_BODY_INCLUDE;
    }


[EMAIL PROTECTED] wrote:


Hi all,

I have a bean which contains a java.util.Date field which I need to print in my JSP. Unfortunatly when I just use:

<bean:write name="myBean" property="date"/>

The date get's printed in the (default) American / English format:

Thu Oct 02 08:58:34 CEST 2003

I need to present a localized version of the date (Dutch standard format).

What is a good way of achieving this?

Many thanks,

Harm de Laat
Informatiefabriek
The Netherlands


--------------------------------------------------------------------- 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