1.后台数据:
/** List of days. */
private Collection<Date> examDays;
/** The map list. */
private List<Map> examDayList = new ArrayList<Map>();
SimpleDateFormat df = new SimpleDateFormat("dd");
for (Date examDay : examDays) {
Map examDayMap = new HashMap();
examDayMap .put("examDay", examDay);
//如果examDay = '2012-12-06' ,则 df.format(examDay) = 06
examDayMap .put("day", df.format(examDay));
examDayList .add(examDayMap);
}
2.前台展示:
<s:select
name="examDay"
requiredLabel="true"
list="examDayList "
listValue="%{day}" listKey
="examDay"
headerKey="" headerValue="--" />
3. If you want the default value displayed in the drop-down box, you can set <s:select / > the value of the attribute value in
Struts2 tag <s:select /> application
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=327042057&siteId=291194637
Recommended
Ranking