struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maven apache <apachemav...@gmail.com>
Subject Re: any option parameter for populating parameters to my bean?
Date Fri, 10 Dec 2010 01:06:49 GMT
2010/12/10 Li Ying <liying.cn.2010@gmail.com>

> 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 <apachemaven0@gmail.com>:
> > My action:
> >
> > public class MyAction{
> >  private MyBean bean;
> >  //getter setter.....
> > }
> >
> > public class MyBean{
> >  private Date start;
> >  //setter getter....
> > }
> >
> > <s:form....
> > <s:textfield .... name=bean.start />
> >
> > 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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message