Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java

Ricardo Sala
Ricardo Sala
13,390 Points

Failed to convert property value of type 'java.lang.String'

What am I doing wrong here:

                        ```<select th:field="*{role}">
                            <option value="#" disabled = "disabled" selected="selected">Role...</option>
                            <!--<option th:each="r : ${roles}" th:value="${r}" th:text="${r.name}">Developer</option>-->
                            <option th:each="r : ${roles}" th:value="${r.id}" th:text="${r.name}">Developer</option>
                        </select>```

I am getting this error:

Field error in object 'collaborator' on field 'role': rejected value [33]; codes [typeMismatch.collaborator.role,typeMismatch.role,typeMismatch.com.imprender.instateam.model.Role,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [collaborator.role,role]; arguments []; default message [role]]; default message [*Failed to convert property value of type 'java.lang.String' to required type 'com.imprender.instateam.model.Role' for property 'role'*; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'com.imprender.instateam.model.Role' for property 'role': no matching editors or conversion strategy found]

I says: Failed to convert property value of type 'java.lang.String' to required type 'com.imprender.instateam.model.Role' for property 'role'

but I don't understand where I am doing that...