hd3.jsp
来自「--- --^_^-------------- 广师公寓中心 1.请装上」· JSP 代码 · 共 256 行
JSP
256 行
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page language="java" import="java.sql.*" %>
<%
int counter=0;
Cookie cookies[]=request.getCookies();
if(cookies!=null){
for(int i=0;i<cookies.length;i++){
if(cookies[i].getName().equals("counter"))
counter=Integer.parseInt(cookies[i].getValue());
}
}
%>
<%
if(session.getAttribute("login")== null)
{%>
<jsp:forward page="login.jsp"/>
<%}
%>
<html>
<head>
<title>后台管理>信息活动</title>
<style type="text/css">
<!--
table {
font-family: "宋体";
font-size: 14px;
color: #000000;
}
.unnamed1 {
border-left-width: thin;
border-left-style: dashed;
border-left-color: #333333;
}
.unnamed2 {
border-top-width: thin;
border-bottom-width: thin;
border-top-style: dashed;
border-bottom-style: dashed;
border-top-color: #333333;
border-bottom-color: #333333;
}
.unnamed3 {
vertical-align: middle;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/background.gif">
<!-- ImageReady Slices (glry) -->
<table id="__01" width="680" height="425" border="0" cellpadding="0" cellspacing="0" align="center" background="images/glry_11.gif">
<!--DWLayoutTable-->
<tr>
<td height="55" colspan="6">
<img src="images/glry_01.gif" width="680" height="55" alt=""></td>
</tr>
<tr>
<td height="46" colspan="6">
<img src="images/glry_02.gif" width="680" height="46" alt=""></td>
</tr>
<tr>
<td height="41" colspan="6">
<img src="images/glry_03.gif" width="680" height="41" alt=""></td>
</tr>
<tr>
<td colspan="6" background="images/glry_04.gif" height="20" alt="">
<font color="#FF0000" size="2"><jsp:include page="time.htm"/>
<%
if(counter==0){
//if(session.getAttribute("counter1") == null){
out.print("欢迎首次光临!");
}
else{
out.print("今天您已经光临了"+counter+"次!");
//out.print("您已经光临了"+session.getAttribute("counter1")+"次!");
}
%></font></td>
</tr>
<tr>
<td width="115" height="19">
<a href="gongyu.jsp"><img src="images/glry_05.gif" alt="" width="115" height="19" border="0"></a></td>
<td width="113">
<a href="ry.jsp"><img src="images/glry_06.gif" alt="" width="113" height="19" border="0"></a></td>
<td width="112">
<a href="xszs.jsp"><img src="images/glry_07.gif" alt="" width="112" height="19" border="0"></a></td>
<td width="113">
<a href="wh.jsp"><img src="images/glry_08.gif" alt="" width="113" height="19" border="0"></a></td>
<td width="113">
<a href="lx.jsp"><img src="images/glry_09.gif" alt="" width="113" height="19" border="0"></a></td>
<td width="114">
<a href="hd.jsp"><img src="images/glry_10.gif" alt="" width="114" height="19" border="0"></a></td>
</tr>
<tr>
<td height="20" colspan="6" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="680" height="20" valign="top" class="unnamed2"><a href="gongyu.jsp">首页</a>>>后台管理>信息活动 <a href="zhexiao.jsp">注销<%=session.getAttribute("username")%></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="205" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="113" height="7"></td>
</tr>
<tr>
<td height="22" valign="top"><a href="hd1.jsp"><img src="images/glry_06.gif" alt="" width="113" height="19" border="0"></a></td>
</tr>
<tr>
<td height="11"></td>
</tr>
<tr>
<td height="20" valign="top"><a href="zs.jsp"><img src="images/glry_07.gif" alt="" width="112" height="19" border="0"></a></td>
</tr>
<tr>
<td height="11"></td>
</tr>
<tr>
<td height="23" valign="top"><a href="hd3.jsp"><img src="images/glry_08.gif" alt="" width="113" height="19" border="0"></a></td>
</tr>
<tr>
<td height="9"></td>
</tr>
<tr>
<td height="23" valign="top"><a href="hd4.jsp"><img src="images/glry_09.gif" alt="" width="113" height="19" border="0"></a></td>
</tr>
<tr>
<td height="9"></td>
</tr>
<tr>
<td height="23" valign="top"><a href="hd6.jsp"><img src="images/glry_13.gif" alt="" width="113" height="19" border="0"></a></td>
</tr>
<tr>
<td height="47"> </td>
</tr>
</table></td>
<td colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="unnamed1">
<!--DWLayoutTable-->
<tr>
<td width="48" height="15"> </td>
<td width="456"> </td>
<td width="59"> </td>
</tr>
<tr>
<td height="20"> </td>
<td valign="top"><a href="addhd3.jsp">添加</a></td>
<td> </td>
</tr>
<tr>
<td height="180"> </td>
<td valign="top">
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
out.print(e);
}
try{
String strDirPath=application.getRealPath(request.getRequestURI());
strDirPath=strDirPath.substring(0,strDirPath.lastIndexOf('\\'))+"\\";
strDirPath=application.getRealPath("ODBC/gongyu.mdb");
String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+strDirPath;
Connection conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement();
if(request.getParameter("del")!=null)stmt.executeUpdate("delete * FROM weihua where id="+request.getParameter("del"));
String sql="SELECT * FROM weihua";
ResultSet rs = stmt.executeQuery(sql);
request.setCharacterEncoding("gb2312");
String next1="";
String time="";
String image="";
while(rs.next()){
next1=rs.getString("next");
String message=rs.getString("message");
time=rs.getString("shijian");
int id=rs.getInt("id");
image=rs.getString("image");
%>
<%!
//下面是将空格换为<br>
StringBuffer mytranslate(StringBuffer sour){
for(int i=0;i<sour.length();i++){
if(sour.substring(i,i+1).equals("\n")){
sour.delete(i,i+1);
sour.insert(i,"<br>");
}
}
return sour;
}
%>
<%
StringBuffer message1 = new StringBuffer(message);
message1 = mytranslate(message1);
%>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="26" colspan="2" valign="top" class="unnamed3"><div align="center">
<a href="addhd3.jsp">添加</a>
</div></td>
<td colspan="2" valign="top" class="unnamed3"><div align="center">
<a href=edithd3.jsp?edit=<%=id%>>修改</a></div></td>
<td width="136" valign="top" class="unnamed3"> <div align="center">
<a href=hd3.jsp?del=<%=id%>>删除</a>
</div></td>
</tr>
<tr>
<td width="82" height="25" valign="top" class="unnamed3"><div align="center"><strong>题目:</strong></div></td>
<td colspan="2" valign="top" class="unnamed3"><%=next1%></td>
<td width="96" valign="top" class="unnamed3"><div align="center"><strong>加入时间:</strong></div></td>
<td valign="top" class="unnamed3"><%=time%></td>
</tr>
<tr>
<td height="102" valign="top" class="unnamed3"><div align="center" class="unnamed3"><strong>内容:</strong></div></td>
<td colspan="4" valign="top" class="unnamed3">
<div align="center"><%=message1%><br><img src="file/<%=image%>" width="200" height="300"></div></td>
</tr>
</table>
<br><br>
<%}
rs.close();
stmt.close();
conn.close();
}
catch(Exception ex)
{
out.print(ex);
}
%>
</td>
<td> </td>
</tr>
<tr>
<td height="32"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="48" colspan="6">
<img src="images/glry_12.gif" width="680" height="48" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?