How to set the selected item in Alloy UI combo box

2019-06-06 17:23发布

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?

标签: jsp liferay
1条回答
贼婆χ
2楼-- · 2019-06-06 18:20

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);
查看更多
登录 后发表回答