Spring MVC <form:select not =“”binding =“”

时间:2016-12-12 15:39:29

标签: java html spring spring-mvc

=“”

我的Spring Web模型 - 视图 - 控制器中有这个类( MVC)框架。 Spring Web模型 - 视图 - 控制器(MVC)框架的版本是3.2.8。

我在JSP中有这个

<form:select id="statusKeyId" path="statusKey" cssStyle="width: 150px" >
    <form:option value="0"><fmt:message key="select.option.all"/></form:option>
    <c:forEach items="${allStatusList}" var="statusVar">
    <form:option value="${statusVar.key}" >                                                 
    <c:choose>
    <c:when test="${!(statusVar.name eq 'AWARDED') && !(statusVar.name eq 'CANCELLED') && !(statusVar.name eq 'IN_PROGRESS') && !(statusVar.name eq 'REFUSED')}" >
        &nbsp;&nbsp;<fmt:message  key="${statusVar.key}" />
    </c:when>
    <c:otherwise>
        <fmt:message  key="${statusVar.key}" />
    </c:otherwise>
    </c:choose>                                                                                                                                                                         
    </form:option>
    </c:forEach>                                    
</form:select>  

这是生成页面的来源:

<select id="statusKeyId" name="statusKey" style="width: 150px">
    <option value="0">All</option>                          
    <option value="AWARDED" selected="selected"> AWARDED </option>
    <option value="NO_PENDING_OPERATIONS"> &nbsp;&nbsp;No pending operations </option>
    <option value="IN_PROGRESS_EXTENSION"> &nbsp;&nbsp;With an In Progress Extension </option>
    <option value="WAITING_FOR_WITHDRAW"> &nbsp;&nbsp;Waiting for Tdk Permit Withdrawal </option>
    <option value="MODIFICATION_IN_PROGRESS"> &nbsp;&nbsp;With modification in progress </option>
    <option value="RENEWAL_REQUEST"> &nbsp;&nbsp;With a pending renewal request </option>
    <option value="DISCARDED">DISCARDED</option>
    <option value="Permit_DISCARDED_EXPIRY_PERMIT"> &nbsp;&nbsp;Expiry of Permit PERMIT </option>
    <option value="Permit_DISCARDED_HOLDER_WITHDRAWAL"> &nbsp;&nbsp;Award Holder Withdrawal </option>
    <option value="Permit_DISCARDED_NON_PAYMENT_FEES"> &nbsp;&nbsp;Non Payment of Fees </option>
    <option value="Permit_DISCARDED_OTHER"> &nbsp;&nbsp;Other </option>
    <option value="IN_PROGRESS">IN PROGRESS </option>
    <option value="REFUSED"> REFUSED </option>
</select>

如您所见,选择了AWARDED选项,但在页面中选择了0 / ALL选项

1 个答案:

答案 0 :(得分:0)

生成的HTML很好,问题在于执行和渲染的顺序。

您需要做的是使用JS以编程方式创建HTML select元素。像LDheatmap package

这样的东西