Hi,
I have gone through hundreds of postings on the e-mail list and sort of found the
answer to my question but can't get it to work.
I have a Collection (ArrayList) called countryList stored in my session that contains
several DTO objects with data from the Database.
I have DTO named CountryDTO
It has
countryID
countryName
countryCapital
I'm displaying data using <logic:iterate> tag. I'm creating a radio button in the
first column and I want it's value to be the value of CountryID so that when the form
submits I can use this ID to update the proper database record.
If my approach (below) is not right please let me know what is a common way to
identify a database record displayed on a page where the radio button is clicked. I'm
not using an Action form since there are no input fields on a page.
Here is my jsp:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<head>
<html:base/>
<title>CountryListing</title>
</head>
<body style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"
link="#000099" vlink="#990099" alink="#000099">
<html:form method="post" action="/HandleCountry">
<table cellpadding="2" cellspacing="2" border="1"
style="width: 50%; text-align: left;" frame="box">
<tbody>
<logic:iterate id="country" name="countryList">
<tr>
<td>
<input type=radio name="country" value=' <bean:write name="country"
property="countryID"/>' >
</td>
<td>
<bean:write name="country" property="countryName"/>
</td>
<td>
<bean:write name="country" property="countryCapital"/>
</td>
</tr>
</logic:iterate>
</tbody>
</table>
<br>
<table cellpadding="2" cellspacing="2" border="0"
style="text-align: left; width: 50%;">
<tbody>
<tr>
<td style="vertical-align: top; text-align: center;">
<html:submit property="method" value="countryAdd"></html:submit> </td>
<td style="vertical-align: top; text-align: center;">
<html:submit property="method" value="countryEdit"></html:submit> </td>
<td style="vertical-align: top; text-align: center;">
<html:submit property="method" value="countryDelete"></html:submit> </td>
</tr>
</tbody>
</table>
<br>
</html:form>
</body>
</html:html>
The problem line is:
<input type=radio name="country" value=' <bean:write name="country"
property="countryID"/>' >
I get an error message:
Cannot find message resources under key org.apache.struts.action.MESSAGE
I'm not using message resources so I think it's a sintax problem.
The following code works, so I know the data in a session is fine:
<% java.util.ArrayList countries = (java.util.ArrayList)
session.getAttribute("countryList");
java.util.Iterator iter = countries.iterator();
while (iter.hasNext())
{
com.some.mgrAppBusiness.CountryDTO countryDto =
(com.some.mgrAppBusiness.CountryDTO) iter.next();
out.println(countryDto.getCountryName());
out.println(countryDto.getCountryID());
}
%>
What am I doing wrong?
Thanks
NK
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]