需求分析:以销售蔬菜为例从数据库读取实时数据,排序,读取销售最多的前三名,将java集合转成JSONArray对象传入jsp页面,定时器刷新即可
工具/原料
Eclipse
方法/步骤
1
建立数据库create table sale( s_id int(11) primary key auto_increment, s_name varchar(30), s_qty int(11));模拟数据库中的数据insert into sale(s_id,s_name,s_qty)values(1,'apple',3000);
2Insert title here
数据库连接,可以参考我之前的经验我这里直接写的jsp全部代码:<%@ page language='java' contentType='text/html; charset=UTF-8' pageEncoding='UTF-8'%>
6
实时热卖
id | name | qty |