Spring MVC Form Tag - 单选按钮

Edg*_*ase 1 java spring-mvc

我一直在尝试遍历承包商的ArrayList,并选择其中一个传递给Controller POST方法.我无处可去.

以下给出了第二个块中显示的错误.我想我并没有正确地解释它.

我只需要选择loginId并将其传递给控制器​​.

<c:forEach items="${searchResults}" var="searchResult">
    <tr>
        <td><c:out value="${searchResult.loginId}" /></td>
        <td><c:out value="${searchResult.email}" /></td>
        <td><c:out value="${searchResult.firstName}" /></td>
        <td><c:out value="${searchResult.lastName}" /></td>
        <td><form:radiobutton path="${searchResult.loginId}" value="${searchResult.loginId}"/></td>
    </tr>
</c:forEach>
Run Code Online (Sandbox Code Playgroud)

错误消息(抱歉长度).

org.apache.jasper.JasperException: org.springframework.beans.NotReadablePropertyException: Invalid property 'BC2506E93E207D1AE040700ACA2479D7' of bean class [java.util.ArrayList]: Bean property 'BC2506E93E207D1AE040700ACA2479D7' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
Run Code Online (Sandbox Code Playgroud)

JB *_*zet 5

path被认为是与表单相关联的命令oject的属性的名称.对于radiobutton标记,如果path属性引用的属性中的值与属性引用的值具有相同的值,则将检查单选按钮value.

因此,如果命令对象具有getFoo()/setFoo()属性,并且getFoo()返回"hello",并searchResult.getLoginId()返回"hello",则返回以下标记

<form:radiobutton path="foo" value="${searchResult.loginId}"/>
Run Code Online (Sandbox Code Playgroud)

将生成以下已检查的HTML无线电输入:

<input type="radio" value="hello" checked="checked"/>
Run Code Online (Sandbox Code Playgroud)

如果searchResult.getLoginId()返回"goodbye",则返回以下标记

<form:radiobutton path="foo" value="${searchResult.loginId}"/>
Run Code Online (Sandbox Code Playgroud)

将生成以下未选择的HTML无线电输入:

<input type="radio" value="goodbye"/>
Run Code Online (Sandbox Code Playgroud)