wh.jsp

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

JSP
192
字号
<%@ 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());
		  }
}
%> 
<%!
String sql="";
%>
<html>
<head>
<title>活动信息</title>
<style type="text/css">
<!--
table {
	font-family: "宋体";
	font-size: 14px;
	color: #000000;
}
.style1 {font-family: "隶书"}
-->
</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">
<SCRIPT LANGUAGE=JavaScript>
<!-- Begin
if (window.print) {
document.write('<form>'
+ '<input type=button name=print value=打印 '
+ 'onClick=javascript:window.print()></form>');
}
// End -->
</script>
<!-- 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 colspan="6" background="images/glry_04.gif" height="20" alt="" bordercolorlight="#009999"><a href="gongyu.jsp">首页</a>>>活动信息</td>
	</tr>
	<tr>
	  <td height="197" colspan="6" valign="top">
		  <table width="100%" border="0" cellpadding="0" cellspacing="0">
		    <!--DWLayoutTable-->
		    <tr>
		      <td width="115" height="14">&nbsp;</td>
              <td width="450">&nbsp;</td>
              <td width="115">&nbsp;</td>
		    </tr>
		    <tr>
		      <td height="57">&nbsp;</td>
		      <td valign="top"><div align="center" class="style1"><font size="+3">宿舍文化节<hr width="200"></font></div></td>
			   
		      <td>&nbsp;</td>
	        </tr>
		    <tr>
		      <td height="96">&nbsp;</td>
		      <td valign="top">
				<table width="100%" cellpadding="0" cellspacing="0" bordercolordark="#0033FF" bordercolorlight="#0033FF">
			      <!--DWLayoutTable-->
<%
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();
sql="SELECT * FROM weihua";
ResultSet rs = stmt.executeQuery(sql); 
request.setCharacterEncoding("gb2312"); 
String next1="";
String message="";
String time="";
String image="";
while(rs.next()){
next1=rs.getString("next");
message=rs.getString("message");
time=rs.getString("shijian");
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);
%>			      <tr>
			        <td width="446" height="31" valign="top"><div align="center"><font size="+1"><%=next1%>
			        </font></div></td></tr>
			      <tr>
			        <td height="31" valign="top"><br><div align="center"><%=message1%><br><img src="file/<%=image%>"></div></td>
	              </tr>	  
			      <tr>
			        <td height="31" valign="top"><div align="right">
			          ----管理员---<br><%=time%>
			          </div><br><hr></td>
		          </tr>
				    <tr>
			        <td height="1"></td>
		          </tr>
<%}  
rs.close();  
stmt.close();  
conn.close();
}
catch(Exception ex)
{  
out.print(ex);
}
%>				  
	            </table></td>
		      <td>&nbsp;</td>
	        </tr>
		    <tr>
		      <td height="30">&nbsp;</td>
		      <td>&nbsp;</td>
		      <td>&nbsp;</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 + -
显示快捷键?