Controller.java
//获取节目列表
@ResponseBody
@RequestMapping(value = "/list")
public ModelAndView list(Page page) throws Exception {
ModelAndView mv = this.getModelAndView();
try {
PageData pd = getPageData();
page.setPd(pd);
mv.setViewName("system/hls/advert_list");
List<PageData> list =hs.listWords(page);
mv.addObject("list",list);
mv.addObject("pd", pd);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return mv;
}jsp <!-- 检索 -->
<form action="<%=basePath%>hls/list.do" method="post" name="userForm" id="userForm"> <table id="table_report" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th class='center' id="L_XUHAO">序号</th>
<th class='center' id="码率状态">码率状态</th>
<th class='center' id="名称">名称</th>
<th class='center' id="切片时间">切片时间</th>
<th class='center' id="包数量">包数量</th>
<th class='center' id="类型">类型</th>
<th class='center' id="地址">地址</th>
<th class='center' id="状态">状态</th>
</tr>
</thead>
<tbody>
<!-- 开始循环 -->
<c:choose>
<c:when test="${not empty list}"> <c:forEach items="${list}" var="hls" varStatus="vs">
<tr>
<td class='center' style="width: 30px;">
${vs.index+1}
</td>
<td class='center'>${hls.rate } kbps</td>
<td class='center'>${hls.name}</td>
<td class='center'>1</td>
<td class='center'>5</td>
<td class='center'>udp/rtp</td>
<td class='center'>${hls.address}</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr class="main_info">
<td colspan="10" class="center" id="L_MEIYOUXIANGGUANSHUJU">没有相关数据</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
</form>
</div>
<script type="text/javascript"> setInterval(timerRate(), 3000);
setTimeout(timerRate(), 3000);
function timerRate(){
$.ajax({
url : '${pageContext.request.contextPath}/hls/list.do',
type : 'post',
dataType : 'json',
success : function(result) { }
});
}
</script> </body>
</html>
//获取节目列表
@ResponseBody
@RequestMapping(value = "/list")
public ModelAndView list(Page page) throws Exception {
ModelAndView mv = this.getModelAndView();
try {
PageData pd = getPageData();
page.setPd(pd);
mv.setViewName("system/hls/advert_list");
List<PageData> list =hs.listWords(page);
mv.addObject("list",list);
mv.addObject("pd", pd);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return mv;
}jsp <!-- 检索 -->
<form action="<%=basePath%>hls/list.do" method="post" name="userForm" id="userForm"> <table id="table_report" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th class='center' id="L_XUHAO">序号</th>
<th class='center' id="码率状态">码率状态</th>
<th class='center' id="名称">名称</th>
<th class='center' id="切片时间">切片时间</th>
<th class='center' id="包数量">包数量</th>
<th class='center' id="类型">类型</th>
<th class='center' id="地址">地址</th>
<th class='center' id="状态">状态</th>
</tr>
</thead>
<tbody>
<!-- 开始循环 -->
<c:choose>
<c:when test="${not empty list}"> <c:forEach items="${list}" var="hls" varStatus="vs">
<tr>
<td class='center' style="width: 30px;">
${vs.index+1}
</td>
<td class='center'>${hls.rate } kbps</td>
<td class='center'>${hls.name}</td>
<td class='center'>1</td>
<td class='center'>5</td>
<td class='center'>udp/rtp</td>
<td class='center'>${hls.address}</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr class="main_info">
<td colspan="10" class="center" id="L_MEIYOUXIANGGUANSHUJU">没有相关数据</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
</form>
</div>
<script type="text/javascript"> setInterval(timerRate(), 3000);
setTimeout(timerRate(), 3000);
function timerRate(){
$.ajax({
url : '${pageContext.request.contextPath}/hls/list.do',
type : 'post',
dataType : 'json',
success : function(result) { }
});
}
</script> </body>
</html>
解决方案 »
- 关于用户注销跳转页问题
- 关于图片上传的问题!!!急急
- 请问如何修改tomcat的端口好
- bean:write 标签的问题:
- 请教一个struts2的${}标签取值问题
- MySql 问题
- 如何实现把Excel文件内容导入到Sqlserver2000数据库中?在线等待....
- 奇怪的数据库问题,weblogic && SQLServer2000
- 用jsp作一个网上购物系统,订单查询这一块我有点迷茫。指点者有分。
- windows下开发的web怎么放到linux下面返回流会出现乱码
- Tomcat7启动,一直卡在At least one JAR was scanned for TLDs yet contained no TLDs就不动了
- 求助,s.execteUpdate(sql);在执行MySQL时报错
2、
<script>
setInterval(function(){
$.get({
url:"list",
dataType:'json',
success:function(data){
var list = data.list;
var tbody = $(tbody);
tbody.html('');
if(list.length==0){
tbody.append(`<tr class="main_info">
<td colspan="10" class="center" id="L_MEIYOUXIANGGUANSHUJU">没有相关数据</td>
</tr>`);
}
else{
$.each(list,function(i,v){
var d = $(this);
var html = `
<td class='center' style="width: 30px;">
`+i+`
</td>
<td class='center'>`+d.rate+`</td>
<td class='center'>`+d.name+`</td>
<td class='center'>1</td>
<td class='center'>5</td>
<td class='center'>udp/rtp</td>
<td cass='center'>`+d.address+`</td>
</tr> `;
tbody.append(html);
});
}
}
});
},3000);
</script>