This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Julio Compadre
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Julio Compadre
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!