This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Spring Combobox selection with HashMap entries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring Combobox selection with HashMap entries" Watch "Spring Combobox selection with HashMap entries" New topic
Author

Spring Combobox selection with HashMap entries

sudheshna Iyer
Ranch Hand

Joined: Aug 20, 2004
Posts: 71
Problem in diplaying and collecting values from jsp combo box:

I have the following in jsp:

<c:if test="${not empty customer.states}">
<form:select path="state" items="${customer.states}"/>
</c:if>

Customer:
HashMap<String, String> state (stateCode, stateDesc)==> Should contain seleted value

HashMap<String, String> states ==> Contains list of stateCode, stateDesc

org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'command' on field 'state': rejected value [IT012]; codes [typeMismatch.command.state,typeMismatch.state,typeMismatch.java.util.HashMap,typeMismatch]; arguments [org.springframework.context.sup
port.DefaultMessageSourceResolvable: codes [command.state,state]; arguments []; default message [state]]; default message [Failed to convert property value of type [java.lang.String] to required type [java.util.Hash
Map] for property 'state'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [
java.lang.String] to required type [java.util.HashMap] for property 'state': no matching editors or conversion st
rategy found]

I guess I have to set up property editors. Is that correct? If yes, can anybody provide simple example of setting up
property editors?
 
Have you checked out Aspose?
 
subject: Spring Combobox selection with HashMap entries
 
It's not a secret anymore!