Tom Bednarz wrote:
So I used
<html:text value="${sessionScope.subscriber.firstname}"
     property="firstname" name="firstname" maxlength="64"
     size="32"/>

Don't specify value. Simply copy the properties from a subscriber object (session scoped or otherwise) to a formbean (the one being used to render the form values). There's a copyProperties method in org.apache.commons.beanutils.BeanUtils:

  http://tinyurl.com/zp6ag

Also, the Spring Framework has a copyProperties method in one of its utility classes. It has the advantage of not throwing a checked exception and its parameter ordering makes more sense to some (myself included).

A reason to not specify a value for html:text, at the view level, is that it overwrites the value in an associated form-bean object. This could lead to overwriting user input or overwriting data that was populated from an Action.

It may be acceptable to specify value on a checkbox, for instance, because user's don't typically interact with this value directly. Still, if a value for a checkbox, like any other form control, was set in a controller class, then a page level value will overwrite data. At the very least, this is counterintuitive. More often, it is incorrect.


-Dave

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

Reply via email to