Sunday, January 17, 2010

Spring bind "java.lang.IllegalArgumentException: No enum const class"

With the migration to Tomcat 6 you must becareful with the "status.value" when comparing values.

Expressions like the following will not work:

<c:if test="${status.value == session }">selected="true"</c:if>

Instead it should be the following:

<c:if test="${criteria.session.value == session.value }">selected="true"</c:if>

Here's a more complete example:

    <b>Session: </b>
    <spring:bind path="criteria.session">
        <select name="${status.expression }" >
        <c:forEach items="${sessions}" var="session" >
            <option value='${session.value }' 
                <c:if test="${criteria.session.value == session.value }">selected="true"</c:if>            
            >${session.name}</option>
        </c:forEach>
        </select>
    </spring:bind>

No comments:

Post a Comment