81,092
社区成员
发帖
与我相关
我的任务
分享
public String searchNotice(){
DbCon db=new DbCon();
Connection con=db.getCon();
PreparedStatement pstmt=null;
ResultSet rs=null;
ArrayList arr=new ArrayList();
String str="";
try {
pstmt=con.prepareStatement("select * from classNotice ");
// pstmt.setInt(1, id);
// System.out.println("ljfsalfjsf");
rs=pstmt.executeQuery();
// System.out.println("Yes or No");
while(rs.next()){
ClassNotice cn=new ClassNotice();
cn.setNoticeTitle(rs.getString(2));
cn.setNoticeDate(rs.getDate(3));
cn.setNoticeContent(rs.getString(4));
arr.add(cn);
}
ActionContext.getContext().put("data", arr);
str="success";
// System.out.println("Come here ~");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
str="error";
}finally{
db.close(con, pstmt, rs);
}
return str;
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>公告内容</title>
<style type="text/css">
h2.style1{
font-size:30px;
color:#ff0000;
}
</style>
</head>
<body>
<table align="center">
<caption>
<th>
<h2 class="style1">公告内容</h2>
</th>
</caption>
<c:forEach items="${data}" var="a">
<tr>
<th align="left">标题:${a.noticeTitle }</th>
</tr>
<tr>
<th align="left">日期:${a.noticeDate }</th>
</tr>
<tr>
<th align="left">内容:${a.noticeContent }</th>
</tr>
<tr><th><br/><br/></th></tr>
</c:forEach>
<tr>
<th align="right"><a href="searchpage.action">返回公告首页</a></th>
</tr>
</table>
</body>
</html>
id=0
2010-7-12 11:11:43 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.NumberFormatException: For input string: "noticeTitle"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at javax.el.ListELResolver.coerce(ListELResolver.java:166)
at javax.el.ListELResolver.getValue(ListELResolver.java:51)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.