我正在使用执行查询
select lastlevel as VERSION,name as DESCRIPTION,
TO_DATE(lastdate, 'DDMONYYYY_HH24:MI:SS') as RELEASEDATE
from mytable where rownum<=10
这里 lastdate 列是 varchar 类型
给出这样的结果
Version Release Date
1.0 2002-11-22
2.0 2003-02-08
我在这里设置上述查询的结果 setLastDate 是日历类型,所以我在方法中设置发布日期的结果
if (rs.getString("VERSION") != null ) { bean.setLastLevel(rs.getString("VERSION").trim());
}
if (rs.getDate("RELEASEDATE") != null )
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(rs.getDate("RELEASEDATE"));
bean.setLastDate(calendar);
}
该值正在像这样 2003-02-08 的 bean 中设置。最后,我将此结果 bean 添加到数组列表“列表”中,例如 list.add(bean);
现在我想要jsp中的所有这些值。我正在使用spring mvc,所以我使用arraylist“列表”返回视图。当我像这样迭代jsp中的值时
<c:forEach var="list" items="${list}">
<td valign="top">${list.lastLevel}</td>
<td valign="top">${list.lastDate}</td>
</c:forEach>
在jsp而不是获取日期我得到这样
Version Release Date
1.0 java.util.GregorianCalendar[time=1037775600000,areFieldsSet=true,
areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="US/Arizona",offset=-25200000,dstSavings=0,useDaylight=false,transitions=12,lastRule=null],firstDayOfWeek= 1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2002,MONTH=10,WEEK_OF_YEAR=47,WEEK_OF_MONTH=4,DAY_OF_MONTH=20,DAY_OF_YEAR=324,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=0, HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-25200000,DST_OFFSET=0]
2.0 java.util.GregorianCalendar[time=1044687600000,areFieldsSet=true,
areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="US/Arizona",offset=-25200000,dstSavings=0,useDaylight=false,transitions=12,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2003,MONTH=1,WEEK_OF_YEAR=6,WEEK_OF_MONTH=2,DAY_OF_MONTH=8,DAY_OF_YEAR=39,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-25200000,DST_OFFSET=0]
请帮我解决这个问题。我需要得到结果中的日期。如何解决这个问题。提前致谢。