-1

Hello im trying to mark as selected or not a select html box i want to compare each option with another string i add to my model in order to determine which is the selected option, the problem is i cant handle it to make it work, it keeps saying equal symbol expected

Here is my code:

                <select name="version" onchange="document.forms['versionForm'].submit();">
                    <c:forEach var="conf" items="${hconfs}" varStatus="status">
                    <c:if test="${conf == 'versionUsed'}">
                        <option value="${conf}"><fmt:formatDate value="${conf}" pattern="dd/MM/yyyy hh:mm:ss a" selected/></option>
                    </c:if> 
                    <c:if test="${conf != 'versionUsed'}">
                        <option value="${conf}"><fmt:formatDate value="${conf}" pattern="dd/MM/yyyy hh:mm:ss a"/></option>
                    </c:if>                         
                    </c:forEach>
                </select>

This is the error i get

org.apache.jasper.JasperException: /WEB-INF/view/configuracion.jsp(86,104) equal symbol expected
4

2 回答 2

1

问题是选择的属性,我放错了,应该这样写:

<option value="${confi}" selected="selected" ><fmt:formatDate value="${confi}" pattern="dd/MM/yyyy hh:mm:ss a" /></option>
于 2013-11-01T19:18:53.043 回答
1

htmlselected需要在标签之外并且是<fmt>标签的一部分option

所以你需要改变这一行:

<option value="${conf}"><fmt:formatDate value="${conf}" pattern="dd/MM/yyyy hh:mm:ss a" selected/></option>

至:

<option value="${conf}" selected><fmt:formatDate value="${conf}" pattern="dd/MM/yyyy hh:mm:ss a" /></option>
                        ^^^^^^^^
于 2013-11-01T19:31:05.667 回答