如何在Alloy UI组合框中设置所选项目? [英] How to set the selected item in Alloy UI combo box?

查看:74
本文介绍了如何在Alloy UI组合框中设置所选项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在合金UI组合框中填充项目后,如何设置所选项目? 我的意思是,插入到组合框中的项目之一应该是默认选择的项目.我该如何设置?

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:

    <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);

这篇关于如何在Alloy UI组合框中设置所选项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆