The problem is that the usual pattern is to do thee following:
Make this same "pattern" but the display action displays a List of populated JavaBeans Objects and th submit receives _Only_ one of the Objects or
get data from business, place it on a List of Objects with the respective values on all properties set and then use a custom made Form-bean that has a member wich is this List.
- JavaBean, Simple Object related to the model, like OrderItem with getter and setter methods for the properties.
- OrderList. (single get /set methods for the List of JavaBean Objects.)
- display_action, colects data from biz and forwards to display.jsp
- display.jsp, shows data from List on request with iterate on html:text or html:select elements
- Submit calls editAction the associates with the Same Form-bean.
My problem is, and I did not see this solved on the search I made in this forum, is that both displayAction and editAction Must use the same Form-bean. Hence the data inside the Form-Bean is List a of Objects, not a single one inside that List.
How to retrieve a single one selected/submited by the user?
(the objective is to then show on another display the order details with several items inside)
(note: I am using Struts 1.3.8 or latter ...jdk 1.6 etc ..)
Joined: Sep 14, 2007
For those with the same basic problem one needs only to search a bit for the answer and for my case there are a lot of solutions.
I choose the less elaborate way to do it.
I populated a custom Form-bean with a new member, a String, after reading the HTML:SELECT javadoc once again and noticing the select attribute -property- refers to the form-bean Member that will contain the htmlption Value of the select option once the form is submited.
As usual, simple solution.
subject: How to retrieve a single Object or object property from pre-populate List...