How to set the selected item in Alloy UI combo box?

江枫思渺然 提交于 2019-12-08 06:51:13

问题


After filling an Alloy UI combo box with items, How can I set the Selected Item? I mean, one of the items inserted into combo box should be the default selected item. How I can set that?


回答1:


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>

java:

    renderRequest.setAttribute("selectedCity", selectedCity);
    List<String> cities = Lists.newArrayList("New Yourk", "Moskau", "London", "Rom");
    renderRequest.setAttribute("cities", cities);


来源:https://stackoverflow.com/questions/10262253/how-to-set-the-selected-item-in-alloy-ui-combo-box

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!