aspose file tools*
The moose likes Struts and the fly likes How to retrieve a single Object or object property from pre-populate List... 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 "How to retrieve a single Object or object property from pre-populate List..." Watch "How to retrieve a single Object or object property from pre-populate List..." New topic
Author

How to retrieve a single Object or object property from pre-populate List...

Julio Compadre
Greenhorn

Joined: Sep 14, 2007
Posts: 10
Hi,

My problem is the following one:
Following the usual pattern on indexed properties to populate a form-bean in a jsp form, display and then edit and send to a new action like advised in:
http://faq.javaranch.com/java/IndexedProperties

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.

Like:

Form-Bean:

- 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 ..)
Regards.

Java Rules!!!
Julio Compadre
Greenhorn

Joined: Sep 14, 2007
Posts: 10
Hi,

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.

Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retrieve a single Object or object property from pre-populate List...
 
Similar Threads
Struts 1.2.9 +text areas.
How to pre-populate an object to update not using DrivenModel aproach
Transferring table data using struts
Pre-populate form
popup - updates parent form bean arraylist