File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes ModelDriven does not update model for property List that was emptied Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ModelDriven does not update model for property List that was emptied" Watch "ModelDriven does not update model for property List that was emptied" New topic
Author

ModelDriven does not update model for property List that was emptied

Jonilie Echavez
Greenhorn

Joined: Jun 26, 2009
Posts: 20
My JSP has a property i will call as 'itemList', which i allow to be emptied if user wants to remove items to it.
This property is set with initial values from what is stored in the database. So initially, itemList will have values [avocado,tomato].

THe JSP page allows add,update,or delete in itemList.



where optionList may or may have values in it.

Debugging using FireBug shows that the values are set correctly in the following instances:

Example:
a) when user has picked or updated values for itemList
itemList = [avocado,salmon]
b) when user has has removed all items
itemList = []

However when i debug the action class that receives the model, it does update the property when the condition is in example (a), but not when it's (b).
When it's (b), the itemList still stores the previous value of the itemList=[avocado,tomato].

Is this a behaviour of ModelDriven, or what am i missing?

Appreciate your help.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ModelDriven does not update model for property List that was emptied
 
Similar Threads
how to handle Item/ItemList entities with EJB ?
explicit vs instance initialization
More Spring(MVC) Dumbness
Nesting problems.
Set bean property values