form:select items problem in spring mvc portlet

Posted by dhaval on Stack Overflow See other posts from Stack Overflow or by dhaval
Published on 2011-01-07T08:16:00Z Indexed on 2011/01/07 10:53 UTC
Read the original article Hit count: 217

Filed under:
|
|

I have a set of drop-down control which I want to render with my custom tag library. The following is the code of the tag lib:

<spring:bind path="${path}">
<c:choose>
    <c:when test="${readOnly}">
        <span class="readOnly">${status.value}</span>
    </c:when>
    <c:otherwise>
        <form:select path="${path }" itemLabel="${label }" itemValue="${value }" items="${itemList}">
        </form:select>
    </c:otherwise>
</c:choose>

And this is the code I have written in the JSP file:

<tag:conditionalListControl path="model.selectedCountry"
        readOnly="false" label="name" value="id"
        listItems="model.countryList" className="simple" />

Upon execution the paring returns the following error:

[jsp:165] javax.servlet.jsp.JspException: Type [java.lang.String] is not valid for option items

But if i change the items="${itemList}" to items="${model.countryList}" which is the list I want to display, it works fine without any problem and also bind to required variables on form submit.

But i don't want to hard code any variables in the tag lib. Any suggestions???

© Stack Overflow or respective owner

Related posts about spring-mvc

Related posts about portlet