I've been struggling to find the problem in my code and I just don't see it.
In my servlet, I create a list of countries and set it into my request:
List<Country> countryList = (new CountryListForm(countryDAO)).getList();
request.setAttribute(ATTRIBUTE_COUNTRY_LIST, countryList);
When I debug my servlet, I see that the list of countries is created and placed into the request.
Next, in my JSP, I get the country list, iterate through it and display the values in a drop-down list:
<select id="clubCountryId" name="clubCountryId">
<c:forEach var="country" items="${countryList}">
<option value="${country.id}">
${fn:escapeXml(country.name)}
</option>
</c:forEach>
</select>
When I debug this, I can see that the countryList is in my request and the countries are present. However, I get nothing in my drop-down list. When I view the source of my page (in Eclipse), I see the following:
<select id="clubCountryId" name="clubCountryId">
<c:forEach var="country" items="[eu.ctt.pojo.Country@c7057c, eu.ctt.pojo.Country@391da0, eu.ctt.pojo.Country@1c7f37d, eu.ctt.pojo.Country@42a6eb, eu.ctt.pojo.Country@1dcc4cd]">
<option value="">
</option>
</c:forEach>
</select>
As you can see, my five objects are present but it just doesn't want to iterate over them. I have other pages where I basically do the same thing (list of countries but not in a drop-down) and I have no problem.
Does anyone have any suggestions?
Thanks in advance!
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…