Re: [Webwork-devel] Handling dates in webwork
Brought to you by:
baldree,
rickardoberg
|
From: Patrick L. <pli...@ho...> - 2002-06-18 22:53:43
|
Man... looking at this code some more, I'm finding a real hard time thinking
of a way getAsText could be used in the PropertyTag. Somehow each value in
the value stack needs an optional PropertyDescriptor associated with it...
and I don't see how this could happen (at least easily)!
-Pat
----- Original Message -----
From: "Patrick Lightbody" <pli...@ho...>
To: <ma...@sm...>
Cc: <web...@li...>
Sent: Tuesday, June 18, 2002 3:21 PM
Subject: Re: [Webwork-devel] Handling dates in webwork
> WW-41 says:
>
> PropertyEditors' getAsText should be utilized when display a string
> representation of a property in webwork. Currently, the code (in many
> places) just gets the toString() representation, which isn't enough. The
> PropertyEditor.getAsText method should be used instead. For example, line
> 126 of PropertyTag.java:
>
> pageContext.getOut().write(value.toString());
>
> I remember looking at the code before, and given the current architecture
I
> couldn't see a way for the ValueStack to figure out what the
PropertyEditor
> should be for each value.
>
>
> ----- Original Message -----
> From: <ma...@sm...>
> To: <pli...@ho...>
> Cc: <web...@li...>
> Sent: Tuesday, June 18, 2002 3:04 PM
> Subject: Re: [Webwork-devel] Handling dates in webwork
>
>
> > Sounds like a JIRA entry ;-).
> >
> > On Tue, 18 June 2002, "Patrick Lightbody" wrote
> >
> > >
> > > OK, so basically we're back to the same problem
> > >
> > > If I change:
> > >
> > > <ui:textfield label="'Date'" name="'objDate'"
> > value="formatDate"/>
> > >
> > > to:
> > >
> > > <ui:textfield label="'Date'" name="'objDate'"/>
> > >
> > > Then the output in the textbox will be:
> > > "Wed Jun 18 00:00:00 PDT 2003" (which is the output
> > of toString()).
> > >
> > > But the expected input must still be "MM/dd/yyyy".
> > This all relates back to
> > > the problem that PropertyEditors only work using
> > setAsText, but not
> > > getAsText (which they really should!). Rickard shot
> > down this suggestion
> > > many many times, but I'd like to throw it out one
> > more time :)
> > >
> > > -Pat
> > >
> > > ----- Original Message -----
> > > From: <ma...@sm...>
> > > To: <pli...@ho...>
> > > Cc: <web...@li...>
> > > Sent: Tuesday, June 18, 2002 2:43 PM
> > > Subject: Re: [Webwork-devel] Handling dates in webwork
> > >
> > >
> > > > The property is set from a default DateEditor that
> > is
> > > > used. WW defines a handful of these in util/editor.
> > Of
> > > > course, you can use your own custom property editor.
> > > > The formatDate() routine is just a helper to format
> > the
> > > > date the way you want. WW could have an implicit
> > > > conversion. I guess I need more feedback to
> > establish
> > > > the best default case.
> > > >
> > > > -Matt
> > > >
> > > > On Tue, 18 June 2002, "Patrick Lightbody" wrote
> > > >
> > > > >
> > > > > So the key is this line:
> > > > >
> > > > > <ui:textfield label="'Date'" name="'objDate'"
> > > > value="formatDate"/>
> > > > >
> > > > > Where formateDate() is a method in BeanUtilTest
> > that
> > > > converts the Date to a
> > > > > String. I'm still a bit confused how the property
> > is
> > > > _set_, but whatever.
> > > > > Either way, why should we have to do all this?
> > > > Couldn't webwork natively
> > > > > handle this conversion based on the locale and
> > some
> > > > BeanUtil.properties
> > > > > file?
> > > > >
> > > > > -Pat
> > > > >
> > > > > ----- Original Message -----
> > > > > From: <ma...@sm...>
> > > > > To: <pli...@ho...>
> > > > > Cc: <web...@li...>
> > > > > Sent: Tuesday, June 18, 2002 2:19 PM
> > > > > Subject: Re: [Webwork-devel] Handling dates in
> > webwork
> > > > >
> > > > >
> > > > > > Take a look at the BeanUtil test page.
> > > > > >
> > > > > > On Tue, 18 June 2002, "Patrick Lightbody" wrote
> > > > > >
> > > > > > >
> > > > > > > Can someone tell me how/if date handling is
> > > > possible
> > > > > > like so:
> > > > > > >
> > > > > > > public FooAction extends ActionSupport {
> > > > > > > public Date getSomeDate() { .. }
> > > > > > > public void setSomeDate(Date someDate) { ...
> > }
> > > > > > >
> > > > > > > ...
> > > > > > > }
> > > > > > >
> > > > > > > Now I want the date input to be done by using
> > an
> > > > HTML
> > > > > > textfield that uses
> > > > > > > the format "MM/dd/yyyy". How can I get this
> > > > string to
> > > > > > be automatically
> > > > > > > converted to a date on input, but also
> > > > automatically
> > > > > > converted back to a
> > > > > > > string on output/error? Last time I brought
> > this
> > > > up,
> > > > > > setAsText worked great,
> > > > > > > but getAsText was non-functional. I was told
> > that
> > > > > > there were other ways
> > > > > > > around this (Rickard I believe told me), but
> > then
> > > > I
> > > > > > think the resolution was
> > > > > > > that the best way to do this was to actually
> > use
> > > > > > String as the property
> > > > > > > value and convert it inside the action. Seems
> > > > rather
> > > > > > ugly to me... Any way
> > > > > > > that i18n can help here?
> > > > > > >
> > > > > > > -Pat
> > > > > > >
> > > > > > >
> > > > > >
> > > >
>
> --------------------------------------------------------------------------
> > > > > --
> > > > > > > Bringing you mounds of
> > > > caffeinated
> > > > > > joy
> > > > > > > >>>
> > http://thinkgeek.com/sf
> > > > > > <<<
> > > > > > >
> > > > > > >
> > _______________________________________________
> > > > > > > Webwork-devel mailing list
> > > > > > > Web...@li...
> > > > > > >
> > > > > >
> > > >
> > https://lists.sourceforge.net/lists/listinfo/webwork-devel
> > > > > >
> > > > > >
> > > >
>
> --------------------------------------------------------------------------
> > > > > --
> > > > > > Bringing you mounds of
> > > > caffeinated joy
> > > > > > >>>
> > http://thinkgeek.com/sf
> > > > <<<
> > > > > >
> > > > > > _______________________________________________
> > > > > > Webwork-devel mailing list
> > > > > > Web...@li...
> > > > > >
> > > >
> > https://lists.sourceforge.net/lists/listinfo/webwork-devel
> > > > > >
> > > >
> > > >
>
> --------------------------------------------------------------------------
> > > --
> > > > Bringing you mounds of
> > caffeinated joy
> > > > >>> http://thinkgeek.com/sf
> > <<<
> > > >
> > > > _______________________________________________
> > > > Webwork-devel mailing list
> > > > Web...@li...
> > > >
> > https://lists.sourceforge.net/lists/listinfo/webwork-devel
> > > >
> >
>
> --------------------------------------------------------------------------
> --
> > Bringing you mounds of caffeinated joy
> > >>> http://thinkgeek.com/sf <<<
> >
> > _______________________________________________
> > Webwork-devel mailing list
> > Web...@li...
> > https://lists.sourceforge.net/lists/listinfo/webwork-devel
> >
>
> --------------------------------------------------------------------------
--
> Bringing you mounds of caffeinated joy
> >>> http://thinkgeek.com/sf <<<
>
> _______________________________________________
> Webwork-devel mailing list
> Web...@li...
> https://lists.sourceforge.net/lists/listinfo/webwork-devel
>
|