• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get results from indexed fields????

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a form that uses a collection of objects (a data transfer object) to display a list of data. One of which is a checkbox. I want to get all the rows back on the submit and loop through them to get the ones that they checked to process them. PROBLEM is I can't get anything on the submit.
Here is the form.

<form-bean name="boRequestListForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="results" type="java.util.Collection"/>
<form-property name="requestType" type="java.lang.String"/>
<form-property name="sortBy" type="java.lang.String"/>
<form-property name="submitParam" type="java.lang.String"/>
<form-property name="requestInd" type="java.lang.String"/>
<form-property name="displayHeading" type="java.lang.String" />
<form-property name="methodToCall" type="java.lang.String" />
<form-property name="approveCBX" type="java.lang.String"/>
</form-bean>

Here is a snippet from the jsp:
<logic:iterate id="list" name="boRequestListForm" property="results" type="com.mercury.maos.data.ApprovalDO">
<tr >
<td><bean:write name="list" property="ticketNo"/></td>
<td><bean:write name="list" property="moduleDesc"/> </td>
<td><bean:write name="list" property="plantDesc"/> </td>
<td><html:checkbox indexed="true" name="list" property="approveCBX"/></td>
<td><bean:write name="list" property="roleName"/> </td>
</tr>
<html:hidden indexed="true" name="list" property="requestInd"/>
</logic:iterate>

On submit, the action doesn't get ANYTHING back. Everything is null. HELP PLEASE? What am I doing wrong???
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i guess the iterate id and the form-property name have to be the same. try the following. sounds stupid, but worked for me...



if this doesn't work, I'll have a look at some sample code at home and post it to you.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


<form-property name="requestInd" type="java.lang.String"/>
...
<form-property name="approveCBX" type="java.lang.String"/>



Shouldn't those be some kind of collection?
I thought that indexed only worked with submitting collections.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oddly, that does seem to work.

I presume it works because it references the collection in your bean - so if you have a collection of addresses, addresses[1].id works while address[1].id doesn't - because there is no address collection to be accessed.

Does that sound like a fair solution?
 
Alister Pate
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For "fair" please read "sensible"! Too much negotiation in my day today....
 
reply
    Bookmark Topic Watch Topic
  • New Topic