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). 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]