Reputation: 1789
I am using Spring MVC,MYSQL, JdbcTemplate in my project.
When I am fetching data from db using drop down list box in JSP page
Instead of showing number upto 0-9. It is showing encrypted values.
The data type that I've passed here is int.
My Controller class:
@RequestMapping(value="/index.htm", method = RequestMethod.GET)
public String executeSecurity(ModelMap model, Principal principal,@ModelAttribute SearchFiller searchFiller) {
List<SearchFiller> adultsList=searchFlightDao.adultsList();
model.addObject("adultsList", adultsList);
String name = principal.getName();
model.addAttribute("author", name);
return "welcome";
}
My part of JSP page:
<form:form action="index" method="get" modelAttribute="searchFiller">
. . .
<tr>
<td>Adults</td>
<td><form:select path="adults">
<form:option value="NONE" label="--- Select ---" />
<form:options items="${adultsList}" />
</form:select>
</td>
<td><form:errors path="adults" cssClass="error" /></td>
</tr>
SearchFiller.java
private int adults;
getters and setters
Is this whether hashcode or encrypted form??
Right answer gets appreciated.
Upvotes: 0
Views: 287
Reputation: 571
So here is the answer:
<tr>
<td>Adults</td>
<td><form:select path="adults">
<form:option value="NONE" label="--- Select ---" />
<form:options items="${adultsList}" itemValue="<propertyName_of_SearchFiller_pojo_you_want_to_pass_set_as_value_of_option>" itemLabel="<propertyName_of_SearchFiller_pojo_you_want_to_show_as_option_on_browser>" />
</form:select>
</td>
<td><form:errors path="adults" cssClass="error" /></td>
</tr>
Upvotes: 1