• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get results from indexed fields????

 
danelle luft
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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???
 
Marcus Pant
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
Alister Pate
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
For "fair" please read "sensible"! Too much negotiation in my day today....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic