jsp hashmap get 错误,请高手帮助
不知道为什么会报错:root cause
java.lang.NullPointerExceptionorg.apache.jsp.liuyan2_jsp._jspService(liuyan2_jsp.java:100)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
页面代码如下:<link rel="stylesheet" type="text/css" href="mycss2.css" />
<body>
<% int page_count = 1;
int row = 5;
int sum_page = 1;
Messagebean mbean = new Messagebean();
int sum_row = mbean.getallcount();
System.out.println("sum_row"+sum_row);
System.out.println(page_count);
HashMap map = mbean.getallmessage(page_count, row);
%>
<div id="main">
<div id="lcol">
<div class="lbox"><div class="h2">你好,欢迎登陆</div>
<div class="lboxpic"><img src="images/center_onepiece.jpg"></div>
<div class="lboxpic"><img src="images/center_onepiece.jpg" /></div>
<div class="lboxpic"><img src="images/center_onepiece.jpg"></div>
<div class="lboxpic"><img src="images/center_onepiece.jpg"></div>
</div>
</div>
<div id="rcol">
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<%
List list = (List) map.get("all");
System.out.println("wangkang4");
for (int i=0;i<list.size();i++)
{System.out.println(list.get(i));
}
if (list.size() < 1) {
%>
<p align="center">目前没有留言 </p>
<%
}
for (int i = 0; i < list.size(); i++) {
Message me = (Message) list.get(i);
%>
<tr>
<td class="context">
<table width="100%" border="0" cellpadding="0"> <tr> <td><strong><%=me.getname()%></strong></td></tr>
<tr>
<td><strong><%=me.getcontext()%></strong></td>
</tr> </table> </td> </tr>
<% } %> </table> </div> </div>
</body>
package com.jsp.bean;
import com.jsp.util.*;
import java.text.SimpleDateFormat;
public class Messagebean {
Connection con = null;
public boolean Insertmessage(Message message)
{略……
}
public HashMap getallmessage(int page_count,int row)
{
HashMap map = new HashMap();
List list = new ArrayList();
con=DataBaseConnection.getConnection();
String sql="select * from message order by id desc limit "+(page_count-1)*row+","+row;
Statement st=null;
ResultSet rs = null;
System.out.println("wa