You wouldn't happen to have another setter method that accepts a different
type (e.g. Date) would you?

for example:

...
...

    public void setExpirationDate(Date expirationDate){

...
...




--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx

----- Original Message -----
From: "Slattery, Tim - BLS" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 08, 2004 3:39 PM
Subject: Date format woes


> I've got a page in my Struts web app that displays a date. It uses
> <fmt:formatDate...> to read a date from the form bean and format it for
> display. I also want to put that date into a <html:hidden...> field so
that
> it can be reloaded when the page is submitted and redisplayed.
>
> The getter returns a Date. The <fmt:formatDate tag gets this and converts
it
> to the "default" format (Sep 9, 2005). No problem there. The
> <html:hidden...> tag retrieves also retrieves it and converts it to this:
> 2005-09-09.
>
> The getter returns a Date, the setter takes a String and converts it to a
> Date. Or it tries to. I've put debug print into the setter, and it
> apparently is not getting called at all! What's going on?
>
> The app is running in Jboss 3.2.5
>
> Here are my getter and setter pair:
>
>     /** setter for expirationDate
>      @param String new value for expirationDate
>     */
>     public void setExpirationDate(String expirationDate)
>     {
>         System.out.println("New date: " + expirationDate);
>         try
>         {
>             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
>             this.expirationDate = sdf.parse(expirationDate);
>         }
>         catch (ParseException ex)
>         {
>             System.out.println("format failed: " + ex.getMessage());
>             this.expirationDate = null;
>         }
>     }
>
>     /** getter for expirationDate
>      @return Date value of expirationDate
>     */
>     public Date getExpirationDate()
>     {
>         return expirationDate;
>     }
>
> Here are the tags from the jsp page:
>
>  <strong>Expiration Date: </strong><fmt:formatDate
>                 dateStyle="default"
> value="${UpdPending.expirationDate}"/><BR>
> <html-el:hidden property="expirationDate"/>
>
>
> --
> Tim Slattery
> [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