jsp,struts,mysql
<%response.setHeader("Refresh","10");%>
使用上面命令来刷新,一段时间后,就报下面的错误了,请问有知道如何解决的吗?
相关代码:com.its.bean.materialService.AllComents(materialService.java:43)
public List AllComents()
{
String sql="select * from infocoments order by time desc";
return dao.AllComents(sql);
}
AllComents(sql)的代码:
public List<materialForm> AllComents(String sql)
{
ConnDB db=new ConnDB();
ResultSet rs=db.select(sql);
List<materialForm> list=new ArrayList<materialForm>();
try {
while(rs.next())
{
materialForm form=new materialForm();
form.setId(rs.getInt("id"));
form.setAuthor_id(rs.getInt("author_id"));
form.setTime(rs.getString("time"));
String uploadtime = rs.getString("uploadtime");
String audittime = rs.getString("audittime");
String releasetime = rs.getString("releasetime");
form.setUploadtime(uploadtime);
form.setAudittime(audittime);
form.setReleasetime(releasetime);
form.setNid(rs.getString("nid"));
int status = rs.getInt("status");
form.setAuditor(rs.getString("author"));
if(status == 0){
form.setStatus("未审核");
form.setColor("#FF0000");
}else if(status == 1){
form.setStatus("已审核");
}else if(status == 3){
form.setStatus("未修改");
}else if(status == 4){
form.setStatus("已修改");
}else if(status ==5){
form.setStatus("已发布");
form.setColor("#6A6AFF");
}
form.setTitle(rs.getString("title"));
form.setAuthor(AllAuthor(rs.getInt("author_id")));
form.setContent(rs.getString("content"));
form.setDetailed_info(rs.getString("audit"));
list.add(form);
}
db.close();
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
报错信息:
javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.ruigao.its.filter.EncodingFilter.doFilter(EncodingFilter.java:42)
root cause
java.lang.NullPointerException
com.mysql.jdbc.ResultSet.findColumn(ResultSet.java:2660)
com.mysql.jdbc.ResultSet.getString(ResultSet.java:2195)
com.ruigao.its.bean.baseDao.AllComents(baseDao.java:327)
com.ruigao.its.bean.materialService.AllComents(materialService.java:43)
com.ruigao.its.action.ComentsAction.toauditcoments(ComentsAction.java:178)
sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)