You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ranjan Dasgupta <ra...@ps.net> on 2000/09/14 22:21:52 UTC

BeanUtils

Hello

In the struts framework's sample implementation of the forms, the validations
(String [] validate) has code like:

if ((firstName == null) || (firstName.length() < 1))
         add to error vector
.
.
.
Could it be done by something like:

if (BeanUtils.getScalarProperty(pif, "firstName") == null .......)
    add to error vector

By doing this we can have a list of required fields (their matching getters),
iterate thru that list and generate the errors accordingly.

Is there a reason for not doing so? I mean bean introspection is slow,
concurrency, or something?

Thanks.
-Ranjan