struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Wilkinson <swilkin...@taliantsoftware.com>
Subject Q: ActionForms and BeanUtils.populate() functionality versus <jsp :setProperty>
Date Fri, 20 Sep 2002 14:53:31 GMT
I have a question regarding on the BeanUtils.populate() relative to
<jsp:setProperty> within Tomcat 4.0.4.  I didn't see anything on this within
the mail-archive, so, if there is a prior thread discussing this please let
me know how to access that thread.

When using an HTML form that contains all input controls for the attirbutes
in a JavaBean called com.mycompany.myClass and using the <jsp:useBean
id="myBean" scope="request" class="com.mycompany.myClass"/> tag and the
<jsp:setProperty name="myBean" value="*"/> the properties that were on the
form but not input by the user are not updated in the bean.  For example, if
I have a String birthDate that is initialized to null in the JavaBean and a
<input type="text" name="birthDate"/> html control on the form, but I don't
enter a value in the form the <jsp:setProperty name="myBean" value="*"/> tag
does not update the attribute with an empty string, but skips it.  (At least
in Tomcat 4.0.4.)  However, using an ActionForm as a base object and using
the struts framework which uses the BeanUtils.populate() the attribute on
the form is set to an empty String.  

Given, the situation above, I was wondering the following:
1) Was a consideration in the design of the BeanUtils class?
2) If 1) is true, can someone explain the motivating factor of the BeanUtils
class and it's difference in opeeration with the <jsp:setProperty> tag
within JSP.
3) Can the BeanUtils class be modified to act like <jsp:setProperty> which
means not setting empty string values in the target bean?


Thanks in advance,

Steve

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message