P
Per Jensen
Group,
I have a web application where some fields on a jsp page are disabled for some
users.
Say user 'admin' has set a bean property to true on a jsp page and
and user 'joe' now edits a page displaying this particular Boolean
property. (Fill in the copying of bean properties to form properties
yourself).
The disabled="true" is on for user joe in the Struts tag because he has
read-only access to the field, so when the form is submitted and
BeanUtils.copyproperties(bean, form) is used, the
Boolean value represented by the checkmark is set to null. This is
because the form has no value for the checkmark because it was disabled.
This is obviously not correct, as user 'joe' had read-only access to the
field.
One solution is to handcode the bean.setter(form.getter), writing logic
which takes into account a user's role.
I wonder what the best practice is in this situation. Pointers and good
advice much appreciated.
Regards,
Per
I have a web application where some fields on a jsp page are disabled for some
users.
Say user 'admin' has set a bean property to true on a jsp page and
and user 'joe' now edits a page displaying this particular Boolean
property. (Fill in the copying of bean properties to form properties
yourself).
The disabled="true" is on for user joe in the Struts tag because he has
read-only access to the field, so when the form is submitted and
BeanUtils.copyproperties(bean, form) is used, the
Boolean value represented by the checkmark is set to null. This is
because the form has no value for the checkmark because it was disabled.
This is obviously not correct, as user 'joe' had read-only access to the
field.
One solution is to handcode the bean.setter(form.getter), writing logic
which takes into account a user's role.
I wonder what the best practice is in this situation. Pointers and good
advice much appreciated.
Regards,
Per