新闻发布项目——后台JSP界面
2024-04-24 07:18:34 阅读次数:23
JSP
<%@page import="bdqn.newsManageServlet.Util.PageUitl"%>
<%@page import="bdqn.newsManageServlet.Service.Impl.newsTbServiceImpl"%>
<%@page import="bdqn.newsManageServlet.Service.newsTbService"%>
<%@page import="bdqn.newsManageServlet.Dao.Impl.newsTbDaoImpl"%>
<%@page import="bdqn.newsManageServlet.Dao.newsTbDao"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" import="bdqn.newsManageServlet.Dao.BaseDao" %>
<%@ page language="java" import="bdqn.newsManageServlet.Dao.newsTbDao" %>
<%@ page language="java" import="bdqn.newsManageServlet.entity.newsTb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台界面</title>
<link href="hype="text/css" />
<script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
<script type="text/javascript">
function clickdel(){
if(confirm("是否要删除该条新闻?")==true){
return true;
}else{
return false;
}
}
</script>
</head>
<body>
<ul class="classlist">
<%
//newsTbDao newdao=new newsTbDaoImpl();
newsTbService newsService=new newsTbServiceImpl();
//获取总记录数
int recordCount=newsService.getNewsCount();
int pagesize=5;
int pageindex=1;//默认是第一页
//获取当前页的传值
String curPage = request.getParameter("curPage");
//第一次访问该页面没有传值,所以为null
if (curPage == null) {
pageindex = 1;
} else {
pageindex = Integer.parseInt(curPage);
}
PageUitl pageutil = new PageUitl();
pageutil.setPagesize(pagesize);
pageutil.setRecordCount(recordCount);
//获取总页数
int pageCount = pageutil.getTotalPageCount();
//
if(pageindex<1){
pageindex=1;
}else if(pageindex>pageCount){
pageindex=pageCount;
}
pageutil.setPageindex(pageindex);
//获取当前页新闻
List<newsTb> newsList = newsService.getPagingNews(pagesize,
pageindex);
for (int i = 0; i < newsList.size(); i++) {
newsTb news = newsList.get(i);//获取每条新闻
%>
<li><a href="
<span> 作者: <%=news.getAuthor() %> <a
href='
<a
href='el()'>删除</a> </span></li>
<!-- 满足条件的话显示空行 -->
<%if((i+1)%5==0){ %>
<li class='space'></li>
<%} %>
<% } %>
<p align="right">
当前页数:[<%= pageindex%>/<%=pageCount %>]
<%if(pageindex>1){ %>
<a href="
<a href="
<%} %>
<%if(pageindex<pageCount){ %>
<a href="26gt%3B">下一页</a>
<a href="
<%} %>
</p>
</ul>
</body>
</html>
版权声明:本文内容来自第三方投稿或授权转载,原文地址:https://blog.51cto.com/u_12718584/2843624,作者:穆雄雄的博客,版权归原作者所有。本网站转在其作品的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如因作品内容、版权等问题需要同本网站联系,请发邮件至ctyunbbs@chinatelecom.cn沟通。
上一篇:定长顺序表--查找子表操作
下一篇:关于地址栏传递中文参数的乱码的终极解决方案