serviceinfo.jsp

来自「这是一个上传下载的原代码」· JSP 代码 · 共 192 行

JSP
192
字号
<%@page language="java" import="java.util.*,com.model.entity.NewsInfo,com.project.util.DateTimeUtil" pageEncoding="UTF-8"%>
<%
	//每次显示多少
	int pageSize = 10;
	int pageNum = 0;
	int sumNum = 0;
	int totalPage = 0;
	int falg = 0;
	int num = 0;
	List list = null;
	List newsList = new ArrayList();
	Integer temp = 0;
	Integer IpageNum = 0;
	
	if(session.getAttribute("userInfo") == null){
		response.sendRedirect(request.getContextPath() + "/login.jsp");
	}else{
		Map newsMap = (Map)request.getAttribute("service");
		
		list = (List)newsMap.get("serviceInfo");
		temp = (Integer)newsMap.get("newsNum");
		IpageNum = (Integer)newsMap.get("pageNum");
		
		
		//当前页号
		pageNum = IpageNum.intValue();
		//共多少条
		sumNum = temp.intValue();
		//共多少页
		totalPage =  0;
		falg = 0;
		if(sumNum < pageSize ){
			totalPage = 1;
		}else{
			if(sumNum % pageSize == 0){
				totalPage = sumNum / pageSize;
			}else{
				falg = 1;
				totalPage = sumNum / pageSize + 1;
			}
		}
		for(int i=0;i < totalPage;i++){
			if(pageNum == i){
				num = i;
			}
		}
	}

%>
<html>
<Script>
function nextPage(pageNum,pageSize){
  	document.serviceForm.pageNum.value = pageNum;
  	document.serviceForm.pageSize.value = pageSize;
  	document.serviceForm.submit();
}
</Script>
<head>
<title>经济运行调度信息网</title>
<style type="text/css">
@import url("css.css");
</style>
<link href="<%=request.getContextPath() %>/jsp/css/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
	color: #666666;
	text-decoration: none;
}
a:visited {
	color: #666699;
	text-decoration: none;
}
a:hover {
	color: #003399;
	text-decoration: none;
}
a:active {
	color: #FF0000;
	text-decoration: none;
}
-->
</style>
<style type="text/css">
<!--
body {
	background-image: url(<%=request.getContextPath() %>/jsp/images/bei.gif);
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	bgcolor:#ffffff
}
-->
</style>



<script language=JavaScript>
function DoEmpty(params)
{
if (confirm("真的要删除吗?"))
	window.location = "<%=request.getContextPath() %>/delnews.do?newsId=" + params;
}
</script>
</head>
<body>

<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="serviceForm"  action="<%=request.getContextPath() %>/service.do" method="post">
<input name="pageNum" type="hidden" value="" />
<input name="pageSize" type="hidden" value="" />
  <tr>
	<jsp:include flush="true" page="../include/backTop.jsp" />
  </tr>
    <tr>
    <td height="1000" colspan="2" align="center" valign="top" bgcolor="#FFFFFF">
    <table height="500" width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
    <tr valign="top">
  			<td height="9" align="right" valign="top">
  				<table width="300" border="0" valign="top">
			    <tr class="nei20">
			      <a href="javaScript:nextPage('0','<%=pageSize %>');">首页</a>
			      
			      <%if(pageNum >= 1){%>
			      	<a href="javaScript:nextPage('<%=pageNum-1%>','<%=pageSize%>');">上一页</a>
			      <%}else{%>
			       	上一页
			       <%} %>
			      
			      <%if(pageNum < totalPage-1){ %>
			      	<a href="javaScript:nextPage('<%=pageNum+1%>','<%=pageSize%>');">下一页</a>
			      	<a href="javaScript:nextPage('<%=totalPage-1%>','<%=pageSize%>');">尾页</a>
			      <%}else{ %>	
			      	下一页
			      	尾页
			      <%} %>
			      共<%=sumNum %> 条记录
			      第<%=pageNum+1 %>页
			     共<%=totalPage %>页			    </tr>
		    </table>    	</td>
    </tr>
    <tr>
  			<td valign="top">
  			<table width="750" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#FFFFFF" bordercolorlight="000000" valign="top"> 
            <caption>
            </caption>
          <tr> </tr>
            <tr>
            <td width="5%" bgcolor="#EAEAEA"  class="css" align="center">序号</td>
              <td bgcolor="#EAEAEA"  class="css" align="center">标题</td>
              <td width="30%" bgcolor="#EAEAEA" class="css" align="center">文件名</td>
              <td  width="15%" bgcolor="#EAEAEA"  class="css" align="center">上传时间</td>
              <td width="5%" bgcolor="#EAEAEA" class="css">删除</td>
              <td width="5%" bgcolor="#EAEAEA"  class="css">编辑</td>
            </tr>
            <%
		      	for(int i=0;i < list.size();i++){
		      		NewsInfo newsInfo = (NewsInfo)list.get(i);
		      %>
            <tr>
             <%if(i<9){ %>
              <td  class="nei20" align="center"><%=(num == 0)?i+1:String.valueOf(num)+String.valueOf(i+1) %></td>
              <%}else{ %>
              <td  class="nei20" align="center"><%=String.valueOf(num+1)+"0" %></td>
              <% }%>
              <td class="nei20"><%=newsInfo.getTitle() %></th>
              <td class="nei20"><a href="<%=request.getContextPath() %>/downLoad.do?action=ServiceInfo&newsId=<%=newsInfo.getNewsId() %>"><%=newsInfo.getNewsKey() %></a></td>
              <td class="nei20"><%=newsInfo.getCreateDate().substring(0,10) %></th>
                            <td  class="nei20" align="center"><a href="javascript:DoEmpty('<%=newsInfo.getNewsId()%>');">删除</a></td> 
              <td class="nei20"><a href="<%=request.getContextPath() %>/editService.do?newsId=<%=newsInfo.getNewsId() %>">编辑</a></td>
              
            </tr>
<%
		      	}
		      %>
		      
        </table>
        <p></p>
        <div align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" name="Submit" value="添  加" onclick="location.href='<%=request.getContextPath() %>/jsp/back/serviceInfoAdd.jsp'"></div>
        </td></tr>
        
        </table>
      </td></tr>
        <tr>
     <jsp:include flush="true" page="../include/foot.jsp" />
  </tr>
   </form>
        </table>
</body>
  </html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?