We have the following
architecture/flow:
components:
List.jsp
EditAction.java
EntityForm.java (contains get/set for action,
get/set for EntityDO)
EntityDO.java
Detail.jsp
SaveAction.java
A user clicks on a link in List.jsp to view the
details of an item.
The EditAction servlet creates an EntityDO and puts
it into the session and the EntityForm.
PropertyUtils.setNestedProperty(form, "DO", createdDO);
The Detail.jsp displays the form elements from the
DO just fine.
The SaveAction servlet is called when the user
submits changes from the form.
The SaveAction servlet grabs the DO from the
session and uses the following line to copy elements from the form into the DO
from the session
PropertyUtils.copyProperties(sessionDO, PropertyUtils.getNestedProperty(form,"DO"));
The problem I am having is that I want ONLY the
elements from the form that are displayed on the screen to be copied into the
sessionDO - HOWEVER, it is copying ALL DO attributes - and many of them are
getting set to their default values.
What I would like is that the sessionDO retains all
values that are not displayed in the form. The weird thing is that some
values are retained from the session, but some are not - and the form seems to
be resetting some values.
I hope I am doing something wrong and this can be
fixed. My workaround in the meantime is to put all DO attributes as hidden
fields in the form, but this seems like a real pain.
Thanks,
Matt
|
- PropertyUtils.copyProperties Fred Lo
- RE: PropertyUtils.copyProperties Cook, Levi
- PropertyUtils.copyProperties Matt Raible
- PropertyUtils.copyProperties Darren Hill
- RE: PropertyUtils.copyProperties Darren Hill