2011-01-07 7 views
1

カスタムタグライブラリでレンダリングするドロップダウンコントロールがあります。以下は、タグのlibのコードです:フォーム:spring mvcポートレットで項目を選択

<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> 

そして、これは私がJSPファイルに書かれているコードです:

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

実行時ペアリングは次のエラーが返されます。

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

しかし、私はitems="${itemList}"items="${model.countryList}"にWHIを変更した場合chは表示したいリストですが、問題なく正常に動作し、フォーム送信時に必要な変数にバインドします。

しかし、タグlibの変数をハードコードしたくありません。 提案がありますか?

答えて

1

次の変更で問題が

Contact.jsp

このため
<tag:conditionalListControl path="model.selectedQualification" 
     readOnly="false" label="name" value="id" 
     listItems="${model.qualificationList}" className="simple" /> 

conditionalListControl.tag

<%@ attribute name="listItems" required="true" type="java.util.List" %> 
+0

おかげで男を行っています! –