You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Parm Lehal <pl...@lehal.net> on 2009/12/17 20:26:52 UTC

Re: Problem with Date fields in struts2.1.8.1

I migrated from struts2.1.6 to 2.1.8.1 and all of a sudden my date
fields don't get saved any more.  Has anyone else faced this issue?
Please, help. I am using plain text field for date and using getter and
setter methods in the model class to format the date.


the form has 
<s:textfield key="t1gen.vdat1s" required="true"
value="%{t1gen.vdat1}" size="10" maxlength="10"  label="Date of Birth
(yyyy/mm/dd)"/>



Setter in the model class 


public void setvdat1s(String vdat1s) {
	this.vdat1s = vdat1s;
	if (vdat1s != null) {
	    try {

		this.vdat1 = Format.parseDate(vdat1s);

	    } catch (Exception e) {
		e.printStackTrace();
	    }
	}
    }

vdat1s is a String ad vdat1 is Date.




Regards,

Parminder Lehal


-

Re: Problem with Date fields in struts2.1.8.1

Posted by Greg Lindholm <gr...@gmail.com>.
Your setter should be setVdat1s() with a capital V to match java bean standards.

There has been other reports on this list of this issue.


On Thu, Dec 17, 2009 at 2:26 PM, Parm Lehal <pl...@lehal.net> wrote:
> I migrated from struts2.1.6 to 2.1.8.1 and all of a sudden my date
> fields don't get saved any more.  Has anyone else faced this issue?
> Please, help. I am using plain text field for date and using getter and
> setter methods in the model class to format the date.
>
>
> the form has
> <s:textfield key="t1gen.vdat1s" required="true"
> value="%{t1gen.vdat1}" size="10" maxlength="10"  label="Date of Birth
> (yyyy/mm/dd)"/>
>
>
>
> Setter in the model class
>
>
> public void setvdat1s(String vdat1s) {
>        this.vdat1s = vdat1s;
>        if (vdat1s != null) {
>            try {
>
>                this.vdat1 = Format.parseDate(vdat1s);
>
>            } catch (Exception e) {
>                e.printStackTrace();
>            }
>        }
>    }
>
> vdat1s is a String ad vdat1 is Date.
>
>
>
>
> Regards,
>
> Parminder Lehal
>
>
> -
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org