servlet查询代码如下
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); ServletOutputStream out=response.getOutputStream(); String stnm=request.getParameter("stnm"); try { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select * from qstation where stnm ='"+stnm+"'"); while (rs.next()) { ResultSetMetaData rsmd1 = rs.getMetaData(); int count = rsmd1.getColumnCount(); String all=""; for (int i =1; i < count+1; i++) { all=all+rs.getString(i)+","; } System.out.println(all); out.println(all); } } catch (Exception e) { // TODO: handle exception } }
system.out.println打印的消息是:
58238,320101,null,060602,南京,11880.0,3200.0,1,125.0,null,苏,南京市,南京市辖区,长江流域,中下游区,长江下游,101190101,华东电网,江苏,1,01,01,2,2,1,220101,
但是前台页面只显示:58238,320101,null,060602,
请问这是什么问题?
相关分类