File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes finding selected record of nested:iterate using nested:form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Security
Reply locked New topic

finding selected record of nested:iterate using nested:form

Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148

It need to iterate through an object containing business information. For each business, I need to print out information about the business and also a submit button for "View Details" (similar to I'm using nested:iterate, nested:form and nested:submit.

My problem is, when a use clicks on the "View Details" button, how will I be able to know which record was selected. Most importantly, I need to know the businessID of the business the user clicked.

Here's my code:

example of my business object:

SearchResultsDTO results1 = new SearchResultsDTO();
results1.setBusinessName("CybexWare Corp.");
results1.setCity("New York");
results1.setServiceDetails("lkel ejlj eiel eoi eiu e ieirne euhahiu i rjehio eriherhreihiurh urhiru");


<form-bean name="SearchResultForm" type="org.apache.struts.validator.DynaValidatorForm">
<!-- Dynamic properties of the Search Results Form -->
<form-property name="SearchResultsDTOs" type="java.util.Collection" />
<form-property name="selectedBusiness" type="java.lang.String" />
<form-property name="businessName" type="java.lang.String" />
<form-property name="businessID" type="java.lang.String" />
<form-property name="city" type="java.lang.String" />
<form-property name="state" type="java.lang.String" />
<form-property name="zipCode" type="java.lang.String" />
<form-property name="serviceDetails" type="java.lang.String" />


<nested:form name="SearchResultForm" action="/searchDetails" type="org.apache.struts.validator.DynaValidatorForm">

<nested:iterate id="searchResults" property="SearchResultsDTOs" indexId="index">

<table width="384" border="0">
<td><img width="75" height="85" src="../images/HairHut.bmp"></td>
<td width="327"><table width="327" height="115" border="0">
<td width="197">

<td><b><nested:write property="businessName" /></b></td>
<td><nested:write property="city" />, <nested:write property="state" /> <nested:write property="zipCode" /></td>
<td width="108" align="right" valign="top">
<nested:submit property="submit" value="View Details"/>
<td rowspan="2" colspan="2"><nested:write property="serviceDetails" /></td>

ThANks in Advance
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63540

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.

Please take special care not to post in forums that have little to do with your topic.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: finding selected record of nested:iterate using nested:form
It's not a secret anymore!