1

Alloy UI コンボ ボックスにアイテムを入力した後、選択したアイテムを設定するにはどうすればよいですか? つまり、コンボ ボックスに挿入された項目の 1 つがデフォルトで選択された項目である必要があります。どうすればそれを設定できますか?

4

1 に答える 1

3

jsp:

    <aui:select name="selectedCity" label="City:" id="selectedCity">
        <c:forEach items="${cities}" var="city">
            <aui:option value="${city}" label="${city}" selected="${selectedCity == city}"/>
        </c:forEach>
    </aui:select>

ジャバ:

    renderRequest.setAttribute("selectedCity", selectedCity);
    List<String> cities = Lists.newArrayList("New Yourk", "Moskau", "London", "Rom");
    renderRequest.setAttribute("cities", cities);
于 2012-04-23T11:00:06.210 に答える