I am interested in this, and agree with Ted that it should be part of the
Struts validator.

Time permitting, I should be able to help out with this, I am pretty
conversant with David's validator code.

I can't find Rey's package in the commons though ? There's also the new
conversion functionality of the Beanutils package, where does this come in ?

Roy Porter.



-----Original Message-----
From: Ted Husted [mailto:[EMAIL PROTECTED]]
Sent: 14 February 2002 09:47
To: Struts Developers List
Subject: Re: [Proposal] - Form Transformations


My only comment is that transformations should be viewed like a
BeanUtil. 

Struts uses the BeanUtil methods to handle autopopulation, but the
BeanUtils themselves are a distinct component.

This problem domain isn't really about Struts, but about transforming
bean properties. 

An extension to BeanUtils, or something that could be easily snapped
into an ActionForm bean (or any other JavaBean) would be very useful. 

Rey Francois has does some interesting work, but I've never really got
the hang of using his package myself. 

http://husted.com/struts/resources/mapper.htm

as has (as mentioned) Ron Smith 

http://www.rpstechnologies.net/struts/

It might also be neat to handle transformations like validations, or
even merge them with the Struts Validator. Both David's and Rey's
packages live in the Commons now, and I think they would be amenable to
merging, especialy if someone gave them a hand.


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Laine Donlan wrote:
> 
> I wanted to poll the group about a concept I have been looking into
> recently -
> 
> Basically, in our current architecture the 'form' objects in our web
> tier are simply decorators for value objects shared by the web and
> middle tier.  While the default Struts transformations (primitive and
> basic Object representations) account for 90% of the properties on these
> value objects - things like dates, timestamps, etc often require code to
> be written in either a form or an action to transform the data before
> sending it across the wire.
> 
> Ideally, Struts could handle these well-known transformations for a
> developer.  The following example outlines kind of what I am thinking
> for a date transformation.
> 
> 1) Scenario
> - Struts form with a value object property - 'data', data has a date
> property - 'start'.
> - Data is input for the 'start' by the user typing a date in the format
> - 'mm/dd/yyyy' and selecting a time from a drop-down.  This data can
> either be form properties or merely request parameters.
> 
> 2) Config
> - The form configuration would need to support the inclusion of
> transformations in the form bean definition:
> 
>  <form-bean name="foo" type="foo.bar.Form">
>         <transformation type="for.bar.transformation.DateTransformation>
>                 <input name="date" value="date.day"/>
>                 <input name="time" value="date.time"/>
>                 <output property="data.start"/>
>         </transformation>
> </form>
> 
> 3) Transformation
> - The transformation itself would be defined by a Interface or set of
> Interfaces.  Struts would be responsible for pulling values from the
> request or from the form and creating a set up input parameters and pass
> them to the transformation instance.
> - The transformation implementation would be responsible for defining
> required and optional inputs - date and time in the above config.  Based
> on those inputs the transformation would be responsible for creating the
> output value
> - Struts would then be responsible for setting the output property on
> the form (or value object in this example)
> 
> I think this would be a valuable addition to Struts as it would
> alleviate trivial development that is often spread throughout a web
> based application.  I have started identifying the hotpoints in Struts
> where this would be plugged in - as well as digging into the code to
> implement.  I would be happy to send it along to the group if the
> concept is perceived to add value to the future direction of Struts.
> 
> Thanks, comments and feedback always appreciated.
> 
> Laine
> 
> 
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

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

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

Reply via email to