java web项目,怎么将sqlserver的表显示在网页上?附的图片上表格没显示出来,怎么解决?

前端代码如图。后台:publicList<DMswBean>getDMAllA(Stringburucode,StringdSname,Stringtime1,Strin... 前端代码如图。后台:public List<DMswBean> getDMAllA(String burucode, String dSname,String time1, String time2,int StartIndex,int pageSize) throws Exception { List<DMswBean> list = new ArrayList<DMswBean>(); Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; String sqlString = ""; sqlString = "select * from (SELECT V_site_data.id, site_station.Sn as Sn, Sname,[Datatime] FROM site_station,V_site_data where site_station.Sn=V_site_data.Sn "; sqlString +=(time1 != null && !"".equals(time1.trim())&&!"null".equals(time1.trim()))?" and [Datatime] > '" + time1.trim() + "'":""; sqlString +=(time2 != null && !"".equals(time2.trim())&&!"null".equals(time2.trim()))?" and [Datatime]< '" + time2.trim() + "'":""; sqlString +=(burucode!= null && !"".equals(burucode.trim())&& !"null".equals(burucode.trim()))?" and burucode='" + burucode.trim() +"'":""; sqlString +=(dSname != null && !"".equals(dSname.trim())&&(!"null".equals(dSname.trim())))?" and site_station.Sname like '%" + dSname.trim() + "%'":""; sqlString += ") t order by t.Datatime offset " + StartIndex + " rows fetch next " + pageSize +" rows only;"; try { conn = DButil.getConnection();// 这个方法就是 pstmt = conn.prepareStatement(sqlString); rs = pstmt.executeQuery(); DMswBean db = null; DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); while (rs.next()) { db = new DMswBean(); String sim = rs.getString("Sn"); String area = rs.getString("Sname"); String ttime = df.format(rs.getTimestamp("Datatime")); //float temperature = rs.getFloat("temperature"); //float level = rs.getFloat("level"); //float voltage = rs.getFloat("voltage");// 电压 //float pressure = rs.getFloat("pressure"); db.setSim(sim); db.setArea(area); db.setTtime(ttime); //db.setTemperature(temperature); //db.setLevel(level); //db.setVoltage(voltage); //db.setPressure(pressure); list.add(db); } } catch (SQLException e) { e.printStackTrace(); } finally { conn.close(); pstmt.close(); rs.close(); } return list; } 展开
 我来答
匿名用户
2017-04-26
展开全部
后台使用log,打印出来调试信息,如查询条件、记录数、等

~~~~~~~~~~~~~~~~
追问
list里面是空的,数据库里表里的数据没成功放进去,burucode、Sname、time1、time2都是NULL
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式