Re: any option parameter for populating parameters to my bean?
2010/12/9 Dave Newton > Strange, I believe this question was asked by someone else with no name-- > try > searching the archives. > How? Using the nabble? I can not access Nabble.com :( > > Dave > > On Thu, Dec 9, 2010 at 4:37 AM, maven apache > wrote: > > > My action: > > > > public class MyAction{ > > private MyBean bean; > > //getter setter. > > } > > > > public class MyBean{ > > private Date start; > > //setter getter > > } > > > > > > > > > If the value of start is '2010-12-12 12:00:00',the parmameter start can > be > > populated to my bean correctly,however if the format is '2010/12/12 > > 12:00:00',it will show me a error "can not parser the date',so I wonder > if > > there is any parameter can be set for populating parameter? > > >
Re: any option parameter for populating parameters to my bean?
2010/12/10 Li Ying > Can you show us the entire Exception stack? > > I guess, this may be a type conversion error. > > According to this struts2 documents: > > http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-BuiltinTypeConversionSupport > > "XWork will automatically handle the most common type conversion for > you. This includes support for converting to and from Strings for each > of the following: " > > "dates - uses the SHORT format for the Locale associated with the > current request" > > > So, I think the following things should be checked first: > What the "Locale associated with the current request" is? > What the short format of this locale is? > Is your input string "2010/12/12 12:00:00" match this short format? > > The default date converter looks like depends on the "Locale > associated with the current request". > So, the format it takes will vary. > > If you want this, you need *create a new converter* which takes a fixed > date format. > Thanks,This is just what I need. > > I did this before, it's not difficult, if you following the document. > > > > 2010/12/9 maven apache : > > My action: > > > > public class MyAction{ > > private MyBean bean; > > //getter setter. > > } > > > > public class MyBean{ > > private Date start; > > //setter getter > > } > > > > > > > > > If the value of start is '2010-12-12 12:00:00',the parmameter start can > be > > populated to my bean correctly,however if the format is '2010/12/12 > > 12:00:00',it will show me a error "can not parser the date',so I wonder > if > > there is any parameter can be set for populating parameter? > > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Re: any option parameter for populating parameters to my bean?
Can you show us the entire Exception stack? I guess, this may be a type conversion error. According to this struts2 documents: http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-BuiltinTypeConversionSupport "XWork will automatically handle the most common type conversion for you. This includes support for converting to and from Strings for each of the following: " "dates - uses the SHORT format for the Locale associated with the current request" So, I think the following things should be checked first: What the "Locale associated with the current request" is? What the short format of this locale is? Is your input string "2010/12/12 12:00:00" match this short format? The default date converter looks like depends on the "Locale associated with the current request". So, the format it takes will vary. If you want this, you need create a new converter which takes a fixed date format. I did this before, it's not difficult, if you following the document. 2010/12/9 maven apache : > My action: > > public class MyAction{ > private MyBean bean; > //getter setter. > } > > public class MyBean{ > private Date start; > //setter getter > } > > > > If the value of start is '2010-12-12 12:00:00',the parmameter start can be > populated to my bean correctly,however if the format is '2010/12/12 > 12:00:00',it will show me a error "can not parser the date',so I wonder if > there is any parameter can be set for populating parameter? > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: any option parameter for populating parameters to my bean?
Strange, I believe this question was asked by someone else with no name--try searching the archives. Dave On Thu, Dec 9, 2010 at 4:37 AM, maven apache wrote: > My action: > > public class MyAction{ > private MyBean bean; > //getter setter. > } > > public class MyBean{ > private Date start; > //setter getter > } > > > > If the value of start is '2010-12-12 12:00:00',the parmameter start can be > populated to my bean correctly,however if the format is '2010/12/12 > 12:00:00',it will show me a error "can not parser the date',so I wonder if > there is any parameter can be set for populating parameter? >
any option parameter for populating parameters to my bean?
My action: public class MyAction{ private MyBean bean; //getter setter. } public class MyBean{ private Date start; //setter getter } If the value of start is '2010-12-12 12:00:00',the parmameter start can be populated to my bean correctly,however if the format is '2010/12/12 12:00:00',it will show me a error "can not parser the date',so I wonder if there is any parameter can be set for populating parameter?