728x90
자바
Calendar calNow = Calendar.getInstance();
int year = Integer.parseInt(UscComUtil.getDateFormat(calNow.getTime(),"yyyy"));
List<String> years = new ArrayList<String>();
for(int i=0; i<=5; i++) {
years.add(year+"");
++year;
}
List<String> times = new ArrayList<String>();
for(int i=0; i<=24; i++) {
times.add(String.format("%02d", i));
}
List<String> minutes = new ArrayList<String>();
for(int i=0; i<=50; i += 10) {
times.add(String.format("%02d", i));
}
jsp
<form:select path="recYear" id="recYear">
<form:option value="">년도선택</form:option>
<c:forEach var="year" items="${years}" varStatus="idx">
<form:option value="${year}">${year}</form:option>
</c:forEach>
</form:select>
<form:select path="recBeginTime" id="recBeginTime">
<form:option value="">시간선택</form:option>
<c:forEach var="time" items="${times}" varStatus="idx">
<form:option value="${time}">${time}시</form:option>
</c:forEach>
</form:select>