--- Kris Schneider <[EMAIL PROTECTED]> wrote:
> String value = BeanUtils.getProperty(form, "propName");
>
> No casting and it works for *any* form, meaning that your Action code is
> independent of your choice of form implementation ("vanilla" or dyna).
Good point but I think it's still a bit verbose for certain use cases.
dynaForm.getString("propName") is tidier and allows for easier to read
nested calls like this:
service.doSomeService(dynaForm.getString("propName"))
instead of:
service.doSomeService(BeanUtils.getProperty(form, "propName"))
which could get quite long if you're passing several properties.
David
> So, FWIW,
> even if you added the method, I personally wouldn't use it. I even find
> using
> PropertyUtils preferable:
>
> String value = (String)PropertyUtils.getProperty(form, "propName");
>
> It's more important to me to abstract the type of the form than the type
> of the
> property.
>
> Quoting Sgarlata Matt <[EMAIL PROTECTED]>:
>
> > >> Casting to String gets to be quite painful with many form
> properties.
> > >> Unless I've forgotten/missed an easier way of dealing with
> > >> DynaActionForms, I propose we add a
> DynaActionForm.getAsString(String)
> > >> method that does this casting for us.
> >
> > This is a minor point, but how about DynaActionForm.getString(String)
> > instead? This would be consistent with naming conventions in
> > java.sql.ResultSet (I can't think of other places with convenience
> > methods like this off the top of my head). Also, following along in
> the
> > java.sql.ResultSet thinking, would you also have getters for the other
>
> > wrappers around primitives and the Date and Calendar objects? This
> > might just clutter the interface... I wouldn't ever personally use
> them
> > in my app because almost every form property is a String.
> >
> > Matt
> >
> > >>
> > >> Thoughts?
> > >>
> > >> David
>
> --
> Kris Schneider <mailto:[EMAIL PROTECTED]>
> D.O.Tech <http://www.dotech.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]