📄 index.jsp
字号:
<%@ page contentType="text/html; charset=gb2312"%>
<%@page import="
java.sql.*,
javax.sql.*,
javax.naming.*,
com.aheadedu.fen.bean.*,
com.aheadedu.fen.service.*"
%>
<%!
public String outDB(String str){
String string=null;
try{
string=new String(str.getBytes("utf-8"),"utf-8");
}catch(Exception e){}
return string;
}
%>
<%
String username=(String)session.getAttribute("username");
if(username==null || username.equals("")){
%>
<script language="javascript">
location='login.jsp';
</script>
<%
}
%>
<%
NewsService ns=new NewsService("jdbc/news");
Connection con=ns.getCon();
Statement stmt=con.createStatement();
Statement stmt1=con.createStatement();
//////////////////////////////////////////
String sql1="SELECT count(*) FROM news";
ResultSet rs0 = stmt1.executeQuery(sql1);
rs0.next();
int resultCount= rs0.getInt(1);
int pageresult=17;
if(resultCount<pageresult){
pageresult=resultCount;
}
int pageCount=0;
if(resultCount!=0){
if ((resultCount % pageresult) ==0){
pageCount = resultCount / pageresult;
}else{
pageCount = resultCount / pageresult +1;
}
}
// int page=0;
String pageInt= request.getParameter("pageActive");//获得访问页面的页码
//判断 假如 pageInt = null 我们就让pageInt =1
if (pageInt == null || pageInt.equals("")){
pageInt = "1";
}
int pageActive = 0;
try{
pageActive=Integer.parseInt(pageInt);
}catch(Exception ex){
pageActive =1;
}
//判断页码
if (pageActive <= 0){
pageActive = 1;
}else if(pageActive>pageCount) {
pageActive=pageCount;
}
int beginResult=0;
beginResult = (pageActive-1) * pageresult;
/////////////////////////////////
ResultSet rs=stmt.executeQuery("select * from news n1,new_kind n2 where n1.kind=n2.kindid order by pub_time desc limit "+beginResult+","+pageresult);
%>
<HTML>
<HEAD>
<TITLE>
<!--Your Company Name-->
Template</TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<!--CharSet-->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<link rel="stylesheet" href="../images/CSS.CSS" type="text/css">
<link rel="stylesheet" type="text/css" href="../util_file/all.css" />
<script language="javascript" src="admin.js"></script>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function window_onload() {
<!--Page.OnLoad-->
}
//-->
</SCRIPT>
<style type="text/css">
<!--
.STYLE1 {
font-size: 16px;
font-weight: bold;
}
.STYLE2 {font-size: 12px}
.STYLE3 {font-size: 12px; font-weight: bold; }
.STYLE4 {color: #666666}
-->
</style>
</HEAD>
<BODY BGCOLOR=#0085B0 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" LANGUAGE=javascript onLoad="return window_onload()">
<!--Counter-->
<!--Something Here-->
<table width="778" border="0" cellspacing="0" cellpadding="0" height="320" align="center">
<tr>
<td colspan="4" height="30"><img src="../images/index_top1.gif" width="778" height="30"></td>
</tr>
<tr>
<td height="250" width="128"><img src="../images/index_top2.gif" width="128" height="250"></td>
<td height="250" width="380" background="../images/index_top3.gif">
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<div align="center"></div>
<div align="center"><font color="#000000"><b><font size="5">
<!--Your Company Name-->
胡玉玺JSP新闻系统
</font></b></font></div> </td>
</tr>
<tr>
<td>
<div align="center"><font size="4" color="#000000">
<!--Your Company Name.English-->
http://www.javaif.com
</font></div> </td>
</tr>
<tr>
<td> </td>
</tr>
</table> </td>
<td height="250" width="220" background="../images/01.gif"><img src="../images/index_pic.gif" width="220" height="250"></td>
<td height="250" width="50"><img src="../images/index_top4.gif" width="50" height="250"></td>
</tr>
<tr>
<td colspan="4" height="40"><img src="../images/index_top5.gif" width="778" height="40"></td>
</tr>
</table>
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center" background="../images/index_bg.gif">
<tr>
<td width="230" valign="top">
<table width="230" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> <br>
<table width="230" border="0" cellspacing="0" cellpadding="0" height="46">
<tr>
<td>
<table width="210" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><b>
<a href="#">
<!--Language-->
<!--Something Here-->
</a></b> </td>
</tr>
</table>
</td>
</tr>
</table>
<table width="230" border="0" cellspacing="0" cellpadding="0" height="46" background="../images/index_lm.gif">
<tr>
<td>
<table width="210" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90"> </td>
<td width="120"><b>
<a href="/mynews/admin/index.jsp">
新闻管理 </a></b> </td>
</tr>
</table>
</td>
</tr>
</table>
<!--Button1.Content.Begin-->
<table width="230" border="0" cellspacing="0" cellpadding="0" height="46" background="../images/index_lm.gif">
<tr>
<td>
<table width="210" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90"> </td>
<td width="120"><b>
<!--Button1.Link-->
<a href="javascript:add()">
<!--Button1-->
添加新闻
</a></b> </td>
</tr>
</table>
</td>
</tr>
</table>
<!--Button1.Content.End-->
<!--Button2.Content.Begin-->
<table width="230" border="0" cellspacing="0" cellpadding="0" height="46" background="../images/index_lm.gif">
<tr>
<td>
<table width="210" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90"> </td>
<td width="120"><b>
<!--Button2.Link-->
<a href="javascript:managerMessage()">
<!--Button2-->
留言管理
</a></b></td>
</tr>
</table>
</td>
</tr>
</table>
<!--Button2.Content.End-->
<!--Button3.Content.Begin-->
<table width="230" border="0" cellspacing="0" cellpadding="0" height="46" background="../images/index_lm.gif">
<tr>
<td>
<table width="210" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90"> </td>
<td width="120"><b>
<!--Button3.Link-->
<a href="/mynews/index.jsp">
<!--Button3-->
返回首页<font size="2"></font></a></b></td>
</tr>
</table>
</td>
</tr>
</table>
<!--Button3.Content.End-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -