hd4.jsp

来自「--- --^_^-------------- 广师公寓中心 1.请装上」· JSP 代码 · 共 224 行

JSP
224
字号
<%@ 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>后台管理&gt;联系我们</title>
<style type="text/css">
<!--
table {
	font-family: "宋体";
	font-size: 14px;
	color: #000000;
}
.style1 {
	font-family: "隶书";
	font-size: 36px;
}
.unnamed1 {
	border-left-width: thin;
	border-left-style: dashed;
	border-left-color: #000000;
}
.unnamed2 {
	border-top-width: thin;
	border-top-style: dashed;
	border-bottom-style: dashed;
	border-top-color: #333333;
	border-bottom-width: thin;
	border-bottom-color: #333333;
}
-->
</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="403" border="0" cellpadding="0" cellspacing="0" align="center" background="images/glry_11.gif">
  <!--DWLayoutTable-->

	<tr>
	  <td height="142" colspan="6" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
	    <!--DWLayoutTable-->
	    <tr>
	      <td width="680" height="55" valign="top"><img src="images/glry_01.gif" width="680" height="55"></td>
        </tr>
	    <tr>
	      <td height="46" valign="top"><img src="images/glry_02.gif" width="680" height="46"></td>
        </tr>
	    <tr>
	      <td height="41" valign="top"><img src="images/glry_03.gif" width="680" height="41"></td>
        </tr>
            </table></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 height="19">
			<a href="gongyu.jsp"><img src="images/glry_05.gif" alt="" width="115" height="19" border="0"></a></td>
		<td>
			<a href="ry.jsp"><img src="images/glry_06.gif" alt="" width="113" height="19" border="0"></a></td>
		<td>			
		    <a href="xszs.jsp"><img src="images/glry_07.gif" alt="" width="112" height="19" border="0"></a></td>
		<td>
			<a href="wh.jsp"><img src="images/glry_08.gif" alt="" width="113" height="19" border="0"></a></td>
		<td>
			<a href="lx.jsp"><img src="images/glry_09.gif" alt="" width="113" height="19" border="0"></a></td>
		<td>
			<a href="hd.jsp"><img src="images/glry_10.gif" alt="" width="114" height="19" border="0"></a></td>
	</tr>
		<tr>
		  <td height="19" colspan="6" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="unnamed2">
		    <!--DWLayoutTable-->
		    <tr>
		      <td width="680" height="18" valign="top"><div align="left"><a href="gongyu.jsp">首页</a>>>后台管理&gt;联系我们                             <a href="zhexiao.jsp">注销<%=session.getAttribute("username")%></a></div></td>
	        </tr>
	                </table></td>
  </tr>
		<tr>
		  <td height="150" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
		  <!--DWLayoutTable-->
		            <tr>
		              <td width="115" height="10"></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="7"></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="7"></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="7"></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="7"></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="1"></td>
          </tr>
          </table></td>
	      <td colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="unnamed1">
	      <!--DWLayoutTable-->
		  <tr>
		    <td width="450" height="7"></td>
	        <td width="113"></td>
		  </tr>
	      <!--DWLayoutTable-->
	      <tr>
	        <td height="47" colspan="2" valign="top"><div align="center" class="style1">留言</div></td>
          </tr>
<%
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 liuyan where id="+request.getParameter("del"));
String sql="SELECT * FROM liuyan";
ResultSet rs = stmt.executeQuery(sql); 
request.setCharacterEncoding("gb2312"); 
String word="";
String name="";
String shi="";
while(rs.next()){
int id=rs.getInt("id");
word=rs.getString("word");
name=rs.getString("name");
shi=rs.getString("shijian");
%>				  
<%!
//下面是将空格换为<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(word);
message1 = mytranslate(message1);
%>	      
		  <tr>
	        <td height="24" valign="top"><div align="left">&nbsp;&nbsp;<%=shi%>&nbsp;&nbsp;by:<%=name%> </div></td>
          <td valign="top"><a href=hd4.jsp?del=<%=id%>>删除</a></td>
		  </tr>
	      <tr>
	        <td height="47" colspan="2" valign="top"><div align="center"><%=message1%></div>	          <br>	          <hr></td>
          </tr>

<%}  
rs.close();  
stmt.close();  
conn.close();
}
catch(Exception ex)
{  
out.print(ex);
}
%>				  
           </table></td>


	<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 + -
显示快捷键?