Hi, you've reached the website of Mark Menard, Freemason, developer, businessman, photographer, motorcyclist and all around nice guy.
The main joy in my life is Sylva, my loving partner and friend. (You will see plenty of pictures of her. Also check out our site.) My professonal career is running a consulting firm concentrating on business automation and custom software. I enjoy software development, motorcycles, photography, dancing, freemasonry and travel.
Here you will find galleries of my latest photos, thoughts on software development, freemasonry, the occassional politics, and other things. Enjoy your time here.
Mark
An ongoing photographic study of Freemasonry.
To contact Mark send an email to mark@mjm.net. You will receive an auto response from my mail server to verify you're not a spammer.
© Mark Menard 2002-2007
I found a method that works, partially though
I am searching for a way to edit a list of entities without using the Map, too.
I tried the method in http://struts.apache.org/2.x/docs/type-conversion.html
Use some format like this in the jsp page:
<s:iterator value="myEntities" id="bean">
<stextfield name="myEntities(%{bean.id}).value" />
</s:iterator>
But it is not working, neither to display the data in jsp page or return value to the list after submit, I played with it and found that if I change it like this:
<s:iterator value="myEntities" id="bean">
<stextfield name="myEntities('%{bean.id}').value" />
</s:iterator>
It is able to display the right value in form, but still can't return value to the list in Action. The List is always reset to null.
Then I figure out a way as follows to make it work in both display and save back to the list in Action.
<s:iterator value="myEntities" status="status">
<s:textfield name="%{myEntities['+#status.index+'].value}" />
</s:iterator>
But I found out that it still create a new instance of myEntities, and save all the values in form to the new myEntities. If you don't display some filed in the form, the field will be null, and the old data is gone. I haven't try your 'Map' solution yet, does your method keep the old data in myEntities even you don't display them in the jsp page?