You could always use instance initializers or the constructor to initialize the form bean properties to empty strings (or whatever you want). If a request parameter has an empty or null value, the corresponding Bean property is not set, so your initial value would still remain in the form.
Joined: Aug 15, 2004
dont know wht your real problem is,
you can initialize your attribute at the time of declaration or in constructor of your bean class.
That would not work. The setter is never called to set it to null. Now, the accessor could perform such a check, but not the mutator.
JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.
I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.