| Author |
Populating Country Values in combobox using spring form tags
|
ujjwal soni
Ranch Hand
Joined: Mar 28, 2007
Posts: 390
|
|
Hi, I am unable to display country list from database on my jsp page. Instead of the country values, i am getting the below output onm my jsp page -----------Output Start--------------------- Project.Domain.Admin.CountryService@d6a0e0 Project.Domain.Admin.CountryService@dbf04d -----------Output End----------------------- The code on my jsp page is as under. <%@ page language="java" pageEncoding="ISO-8859-1"%> <%@ include file="/WEB-INF/jsp/Admin/include.jsp" %> <core:forEach var="county" items="${CountryList}"> <core ut value="${county}"/> </core:forEach> I am using spring Controller & i am sending the List object in HttpRequest parameters of ModelAndView return type. Regards, Ujjwal Soni
|
Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
|
 |
Jason Ferguson
Ranch Hand
Joined: Sep 16, 2007
Posts: 47
|
|
Okay, first some nitpicking: You are mixing "county" and "country" as names. This can lead to massive confusion since the words are similar but have different meanings. Now, I'm assuming that you have a Domain Object named Country, with fields such as "id","name" (or "countryname"), etc. However, in your Expression Language (EL) in <core ut name="">, you are specifying the entire object. This is calling the default "toString()" of that object. Instead, use an EL something like this: ${country.name}, specifying which attribute of the country object to output. Also, in order to keep myself consistent, I usually create an interface for my Domain Objects: I tend to use alot of dynamically created <option> tags, and one of the things this interface allows me to do is always know what the option tags will be populated with. (Also, sometimes I just get going too fast and will name my id and name fields badly). Jason
Originally posted by ujjwal soni: Hi, I am unable to display country list from database on my jsp page. Instead of the country values, i am getting the below output onm my jsp page -----------Output Start--------------------- Project.Domain.Admin.CountryService@d6a0e0 Project.Domain.Admin.CountryService@dbf04d -----------Output End----------------------- The code on my jsp page is as under. <%@ page language="java" pageEncoding="ISO-8859-1"%> <%@ include file="/WEB-INF/jsp/Admin/include.jsp" %> <core:forEach var="county" items="${CountryList}"> <core  ut value="${county}"/> </core:forEach> I am using spring Controller & i am sending the List object in HttpRequest parameters of ModelAndView return type. Regards, Ujjwal Soni
|
 |
 |
|
|
subject: Populating Country Values in combobox using spring form tags
|
|
|