One thing I really don't like is that when I use a form bean in
struts, if the user doesn't type in anything in a form element text
box I would like the form bean member to be set to null not set as an
empty string. If they are empty strings then I'm going to have to
check them all for being empty strings and set them to null before I
do any inserts into the database. Is that the normal behavior of how
form beans work? (my form bean extends ValidatorForm ). If so, how
have others dealt with this design issue. Do you normally modify your
form bean set methods to test for and empty string and if so then
maybe set the field to null? Or do most just check for the empty
string somewhere later? To me it makes more programming sense to be
sure the fields are set to null. If you had a text box ask:
"If you have a brother, type his name: " and the user didn't have a
brother so he didn't type anything, the form would be populated with
brotherName = ""; when really it should be null.

Without struts I had to do all these checks manually anyway (ie. if (
request.getParameter("brotherName") != "" &&
request.getParameter("brotherName") != null ) bean.setBrotherName(
request.getParameter("brotherName") ), so I love who struts takes care
of all of this.  Just wondering where most of you deal with setting
empty strings to null?



-- 

Rick
mailto:[EMAIL PROTECTED]

"Once while walking through the mall a guy came up to me and said
'Hey, hows it going?'. So I grabbed his arm and twisted it up behind
his head and said 'Now whose asking the questions?'" 
  -Jack Handey


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to