These don't necessarily have to exist in the same
form, but I don't see why they shouldn't be supported
if they were.  I disagree that the ConvertUtils should
not be responsible for conversions of this sort.  If
not there where would you suggest they go?  I've been
using the "extra" bean property as you described below
for 1+ years and it works, but to me this is an
unnecessary workaround.  Struts does not ask FormBean
providers to provide String "holders" and convertion
routines for Longs, Integers, etc and in my opinion it
shouldn't for dates.  Given the common usage of dates
in applications, requiring one of the fundamental
datatypes to be handled by every team using struts
seems wrong to me.

--- Joe Germuska <[EMAIL PROTECTED]> wrote:
> OK, good, different kinds of dates (calendar dates,
> times, and 
> months) is a good case -- now, do these co-exist in
> the same form? 
> It's definitely stretching the idea of ConvertUtils
> to think that it 
> would need to convert differently formatted strings
> into the same 
> object type.
> 
> I'm still not completely convinced that the best
> solution isn't to 
> write your own ActionForm class that has two
> properties, 'date' and 
> 'dateAsString' (or whatever you want to call them)
> and behind the 
> scenes, when one of the properties simply sets and
> returns a data 
> member, and the other parses and formats values.
> 
> I'm not trying to shut you out -- and besides, I'm
> not a committer, 
> so I couldn't if I tried.  I just like debating
> these kinds of design 
> questions and I'm criticizing in that spirit.
> 
> Joe
> 
> 
> At 11:50 AM -0700 7/1/03, Jon Wilmoth wrote:
> >The problem is I have existing code that does
> custom
> >string --> date --> string conversion.  I'm not
> >looking for a better work-around.  I believe this
> is
> >functionality that everyone who builds a struts
> >application will have to implement with custom code
> >and thus is an excellent Struts/BeanUtils
> enhancement
> >candidate!  I do realize this is NOT a simple task
> as
> >it has come up on the mailing list a number of
> times
> >in the last 3 years and still remains not
> implemented.
> >  Here are some use cases that illustrate the
> desired
> >behavior (remember, I'm looking for round-trip
> support
> >of the date datatype):
> >
> >Use Case 1 (Data Input):
> >1) User enter's birthdate in MM/dd/yyyy format
> >..
> >Use Case 2 (Data Input):
> >1) User standard workday start time in "HH:mm"
> format
> >..
> >Use Case 3 (Data Input):
> >1) User enters month of year for month long event
> >(i.e. Black History Month) "MMMM" format
> >..
> >
> >Use Case 3 (Data Output):
> >1) User Admin views list of user names and
> birthdays.
> >2) System displays username and birthday using
> >standard MM/dd/yyyy format.
> >2.a) System will display date in format specified
> by
> >user preferences (i.e. EE MMMM dd yyyy) overriding
> the
> >standard MM/dd/yyyy format.
> >
> >--- Joe Germuska <[EMAIL PROTECTED]> wrote:
> >>  At 10:45 AM -0700 7/1/03, Jon Wilmoth wrote:
> >>  >I did investigate registering "custom"
> converters.
> >>  >Unfortunately, anything that would support
> >>  >non-hard-coded conversion patterns will require
> >>  either
> >>  >a mixed paradygm usage (i.e passing a complex
> >>  object
> >>  >that contains the value to convert and all
> >>  convertion
> >>  >configuration instead of simply the value to be
> >>  >converted) of the existing Converter.convert
> >>  interface
> >>  >or additional parameters.  Since I think
> everyone
> >>  can
> >>  >agree that the first option is confusing and
> should
> >>  be
> >>  >avoided when possible the remaining option is
> to
> >>  >modify/extend the interface.  I agree this
> should
> >>  be
> >>  >communicated within the BeanUtils developer
> mailing
> >>  >list and will cross post this in hopes of
> getting
> >>  >further creative approaches to the problem.
> >>  Because
> >>  >Struts will be responsible for providing the
> means
> >>  to
> >>  >invoke the conversion (and much more) I do feel
> it
> >>  is
> >>  >appropriate for this list to continue to
> discuss
> >>  the
> >>  >Struts/BeanUtil interaction necessary for this
> >>  >functionality.
> >>
> >>  Do you have one or two primary use cases?  I
> don't
> >>  think it needs to
> >>  be radically complicated, but it might be easier
> to
> >>  tell with a
> >>  concrete description of the problem to solve.
> >>
> >>  In general, Struts gives you lots of places you
> >>  could pass in a date
> >>  format string as a property (to an ActionForm,
> to an
> >>  ActionMapping,
> >>  to a PlugIn...  in most applications, I would
> assume
> >>  you'd have one
> >>  standard date input format, so you don't need to
> >>  configure a variety
> >>  of format strings, although if you have a use
> case
> >>  for that, feel
> >>  free to describe it.
> >>
> >>  So if you can pass in a format string to some
> custom
> >>  code that you
> >>  write that can take a String from an ActionForm
> and
> >>  make it a Date
> >>  before it goes into your business objects, does
> that
> >>  solve the
> >  > problem?  The alternative is solving the very,
> very
> >>  complicated
> >>  problem of generalizing string-to-object
> conversion
> >>  for anything that
> >>  has a variable string representation, including
> but
> >>  not limited to
> >>  Dates.  (Or having a special-case hanging off of
> >>  ConvertUtils like a
> >>  third leg...)
> >>
> >>  Joe
> >>  --
> >>  --
> >>  Joe Germuska           
> >>  [EMAIL PROTECTED] 
> >>  http://blog.germuska.com   
> >>  "If nature worked that way, the universe would
> crash
> >>  all the time."
> >>    --Jaron Lanier
> >>
> >>
>
>---------------------------------------------------------------------
> >>  To unsubscribe, e-mail:
> >>  [EMAIL PROTECTED]
> >>  For additional commands, e-mail:
> >>  [EMAIL PROTECTED]
> >>
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >SBC Yahoo! DSL - Now only $29.95 per month!
> >http://sbc.yahoo.com
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
> -- 
> --
> Joe Germuska            
> [EMAIL PROTECTED]  
> http://blog.germuska.com    
> "If nature worked that way, the universe would crash
> all the time." 
>       --Jaron Lanier
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to