Connection conn=Conn.getConn();
List textlist=new ArrayList
PageMsg pm= new PageMsg();
try{
System.out.print(keyword);
PreparedStatement ps=conn.prepareStatement("select * from text where text_title like '%"+keyword+"%'");
ResultSet rs=ps.executeQuery();
while(rs.next()){
Text text =new Text();
text.setText_id(rs.getInt(1));
text.setText_title(rs.getString(2));
text.setText_content(rs.getString(3));
text.setText_addtime(rs.getTimestamp("text_addtime"));
textlist.add(text);
}
int pageSize=5;
int totalSize=textlist.size();
int pageCount=(int)Math.ceil((double)totalSize/pageSize);
if(pageNow<1){
pageNow=1;
}
if(pageNow>pageCount){
pageNow=pageCount;
}
pm.setPageNow(pageNow);
pm.setPageCount(pageCount);
pm.setRow(textlist);
}catch(SQLException e){
e.printStackTrace();
}
return pm;
}