On 1/6/06, Craig McClanahan <[EMAIL PROTECTED]> wrote:
>
> On 1/5/06, Tamas Szabo <[EMAIL PROTECTED]> wrote:
> >
> > >
> > > I'm actually quite happy with what Struts has to offer except for the
> > > deal with having to use ActionForms. I'd really like a Struts-like
> > > framework but allows me to use POJOs to capture my data and provides a
> > > nice way to redisplay that data back to the user if validation fails
> (ie
> > > a POJO that backs a form with a Data datatype will display back the
> > > String they entered).
> >
> >
> > You can bind request parameters to POJOs using Spring.
> > And you can use the SpringBindingActionForm to redisplay the data to the
> > user.
>
>
> What happens on invalid input in this scenario?  For example, when you
> bind
> a parameter to an integer field, and then type "1a3" instead of "123" into
> the field.  The user would expect "1a3" to be redisplayed.



Both the values entered by the user and validation messages are
stored in an Errors object.
You can use SpringBindingActionForm to:
1. expose the error messages from the Errors object to ActionMessages.
2. To expose the values entered by the user from the underlying Errors
object, which of course contains both valid and invalid input (the
SpringBindingActionForm  extends ActionForm and it provides a subclass of
org.apache.commons.beanutils.PropertyUtilsBean)

See the API:
http://www.springframework.org/docs/api/org/springframework/web/struts/SpringBindingActionForm.html

... or the code:
http://cvs.sourceforge.net/viewcvs.py/springframework/spring/src/org/springframework/web/struts/SpringBindingActionForm.java?view=markup




Craig


Tamas

Reply via email to