日期:2014-05-18  浏览次数:20712 次

jsp打印表中日期
我数据库中表里一个字段是日期,在jsp页面中打印出来该写什么?
<%=rs.getString(2)%>
这里的rs.后面应该带什么?

------解决方案--------------------

------解决方案--------------------

------解决方案--------------------
SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition parseposition = new ParsePosition(0);
Date date = simpledateformat.parse(s, parseposition);
------解决方案--------------------
<td> <%=rs.getString("date")%> </td> 
如果查出来的结果为第二列,也可以用<td> <%=rs.getString(2)%> </td>
------解决方案--------------------
格式化一下
SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd");
simpledateformat.formact(rs.getString(2));