Jsp 如何在Alloy UI组合框中设置所选项目?

Jsp 如何在Alloy UI组合框中设置所选项目?,jsp,liferay,Jsp,Liferay,在用项目填充Alloy UI组合框后,如何设置所选项目? 我的意思是,插入到组合框中的一个项目应该是默认选中的项目。如何设置它?jsp: <aui:select name="selectedCity" label="City:" id="selectedCity"> <c:forEach items="${cities}" var="city"> <aui:option value="${city}" label="$

在用项目填充Alloy UI组合框后,如何设置所选项目? 我的意思是,插入到组合框中的一个项目应该是默认选中的项目。如何设置它?

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 cities=Lists.newArrayList(“新尤克”、“莫斯考”、“伦敦”、“罗马”);
renderRequest.setAttribute(“城市”,城市);
是否需要id=“selectedCity”?
    renderRequest.setAttribute("selectedCity", selectedCity);
    List<String> cities = Lists.newArrayList("New Yourk", "Moskau", "London", "Rom");
    renderRequest.setAttribute("cities", cities);