- 论坛徽章:
- 0
|
List list = new ArrayList();
GregorianCalendar theDate = new GregorianCalendar();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
theDate.roll(Calendar.MONTH , Calendar.JANUARY - theDate.get(Calendar.MONTH));
for(int i=0 ;i < 12; i++) {
sdf.format(theDate.getTime())
theDate.add(Calendar.MONTH, 1);
}
request.setAttribute("list", list);
把以上的逻辑放在servlet或action中,同时把list放在request中
然后界面上通过
<select name="chDate">
<c:forEach items="requestScope.list" var="item">
<option value="${item}">${item}</option>
</c:forEach>
</select> |
|