Sanyifejű
Sanyifejű

Reputation: 2740

Select box is seemingly empty with Spring MVC

I want to use a select field on my Spring MVC application.

<c:if test="${!empty REPORTED_WORD_LIST}">
        <form method="post" action="seeReportedWordsOneByOne.html">

            <select name="fityma" onchange="submit()">
                <c:forEach items="${REPORTED_WORD_LIST}" var="rep">
                    <option value="${rep.german}"></option>
                </c:forEach>
            </select>


        </form>
    </c:if>

When the page opens all the options are seemingly empty. Nevertheless as many empty options appear as the content of the REPORTED_WORD_LIST. (so if the list contains for example 3 objects, let say "A", "B", and "C" then I can see three empty options when I click on the select) But those fields are just seemingly empty. When I submit the form, I can get either "A", or "B" or "C" in the Controller. To summarize, the submit works, but the display does not.

Am I missing something obvious? It is important to note my browser is Chrome. ( I cant this try out on IE, I tried but I finished because I can't reach localhost on it..)

Upvotes: 0

Views: 468

Answers (1)

white
white

Reputation: 1913

Shouldn't it be

<c:if test="${!empty REPORTED_WORD_LIST}">
        <form method="post" action="seeReportedWordsOneByOne.html">

            <select name="fityma" onchange="submit()">
                <c:forEach items="${REPORTED_WORD_LIST}" var="rep">
                    <option value="${rep.german}">${rep.german}</option>
                </c:forEach>
            </select>


        </form>
</c:if>

Upvotes: 3

Related Questions