在這個論壇的很多帖子中都會調用類似的問題;但沒有人有解決方案,具體的一個,我感謝你在這幫助我:JSP form:checkbox into c:foreach
我使用spring來開發一個web應用程序, 我不知道我應該在表單的路徑:checkbox標籤其中C內:的foreach一個,這是我的代碼:
<c:forEach items="${persons}" var="person" varStatus="i">
<tr>
<td><c:out value="${person.firstName}" /></td>
<td><c:out value="${person.lastName}" /></td>
<td><form:checkbox path="person.rights" value="Download"/>Download </td>
<td><form:checkbox path="person.rights" value="Delete"/>Delete </td>
</tr>
</c:forEach>
「rights
」是因爲它的彈簧文檔中定義的字符串列表,它具有一個吸氣和一個設置器等的其他屬性,我的複選框在c:foreach
標籤之外工作,但在將它們包含到此標籤中時,會生成以下異常:
org.springframework.beans.NotReadablePropertyException: Invalid property 'person' of bean class [java.util.ArrayList]: Bean property 'person' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
你有什麼問題的想法?
請發佈人員權限屬性如何獲取/設置定義。 – kosa 2012-07-13 21:49:10
我確定這個問題不在我的getter和setter中,它在'路徑'中; 'String [] rights = new String [] {}; \t public String [] getRights(){ \t \t return rights; \t} \t \t 公共無效setRights(字符串[]權利){ \t \t此。權利=權利; \t}' – maouven 2012-07-13 21:50:32
不應該那兩個複選框是不同的屬性?爲什麼都指向人的同一個屬性? – kosa 2012-07-13 21:53:34