⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.jsp

📁 jsp实现留言板...适合jsp的初学者!
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*,java.util.*,java.io.*" errorPage=""%>
<%@ page   session="true"%>    
<%@page   pageEncoding="gbk"%>   
<%request.setCharacterEncoding("gbk");%>   
<%@ include file="conn.jsp"%>
<%@ include file="config.jsp"%>
<%!
public String getStr(String s){
String str=s;
try{
byte b[]=str.getBytes("gbk");
str=new String(b);
return str;
}
catch(Exception e){return null;}
} 
%>
<%
		int i=0,x=0;//计数器
		int showrow=4;//每页显示条数
		int pages=0;//当前页数
		int start; //本页开始条数
		String sql="select * from "+tab+" order by id desc"; 
		java.sql.ResultSet rs = st.executeQuery(sql);
		String strp=(String)request.getParameter("pages");
		String pass=null;
		pass=(String)session.getAttribute("pass");

		int sig=1,alt;
		if(strp==null){sig=1;}else{
		for(int i1=0;i1<strp.length();i1++){
		alt=strp.charAt(i1);
		if(alt<48||alt>57){
		sig=1;break;
		}else{sig=2;}
		}
		}
		if(sig==1){pages=1;}else{pages=Integer.parseInt(strp);}
		
		rs.last();
		int count=rs.getRow();
		int laspc;
		int pa=count/showrow;
		if(count%showrow>0){pa=pa+1;laspc=count%showrow;}else{laspc=showrow;}
		if(pages<0)pages=1;
		if(pages>pa)pages=pa;
		start=(pages-1)*showrow+1;
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<link href='css/main.css' rel='stylesheet' type='text/css'>
<title><%=getStr(sitename)%>--http://hi.baidu.com/lovekaili</title>
</head>

<body topmargin="0">
    <table align="center" width="675" height="922" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="675">
		
		<form name="form" method="post" onSubmit="return check_form(this)" action="save.jsp">
<div align="center"> 
      <table border="0" cellpadding="0" cellspacing="0">
        <tbody> 
        <tr> 
          <td colspan="3"><img src="img\frame_tct.gif" width="500" height="140" border="0" usemap="#Map"></td>
        </tr>
        <tr> 
          <td width="12" background="img/frame_tcl.gif"></td>
          <td bgcolor="#ffffff" width="476" align="center"><table width="421" border="0" cellpadding="0" cellspacing="0">
              <tbody> 
              <tr> 
                <td align="center" width="164" valign="middle" height="30"><div align="right"><img src="img\Fi_fu1.gif" width="12" height="12" border="0"></div></td>
                <td width="40" valign="middle"><a href="index.jsp" target="_self" class="STYLE1">HOME</a></td>
                <td align="center" width="21" valign="middle"><img src="img\Fi_fu1.gif" width="12" height="12" border="0"></td>
                <td width="40" valign="middle"> 
                  <a href="#"></a>                <a href="http://wapbase.cn/bbs" target="_blank" class="STYLE1">BBS</a></td>
                <td align="center" width="16" valign="middle"><img src="img\Fi_fu2.gif" width="12" height="12" border="0"></td>
                <td width="41" valign="middle"><a href="login.jsp" target="_blank">BLOG</a></td>
                <td align="center" width="15" valign="middle"><img src="img\Fi_fu1.gif" width="12" height="12" border="0"></td>
                <td width="40" valign="middle"><a href="login.jsp">ADMIN</a></td>
                <td align="center" width="44" valign="middle"><% if("y".equals(pass)){ %><a href="loginout.jsp">退出</a><%}%></td>
              </tr>
              </tbody> 
            </table>
            <table border="0" cellpadding="0" cellspacing="0">
              <tbody> 
              <tr> 
                <td valign="middle"><img src="face/m01.gif" name="tus" alt="偶的个人形象" align="absmiddle"></td>
                <td width="35"></td>
                <td valign="middle"> 
                  <table width="288" border="0" cellpadding="0" cellspacing="0">
                    <tbody> 
                    <tr><script>function showimage(){document.images.tus.src="face/"+document.form.p1.options[document.form.p1.selectedIndex].value+""+document.form.p2.options[document.form.p2.selectedIndex].value+".gif";}</script> 
                      <td style="color:#999900;">主题:</td>
                      <td width="6"></td>
                      <td>
                        <input name=title type=text class="inp_set1" id="title" onFocus="this.style.backgroundColor='#fffdf7'" onBlur="this.style.backgroundColor='#FFFFFF'" value="" size="30" maxlength="12">                      </td>
                    </tr>
                    <tr> 
                      <td style="color:#999900;">昵称:</td>
                      <td width="6"></td>
                      <td>
                        <input name=name type=text class="inp_set1" id="name" onFocus="this.style.backgroundColor='#fffdf7'" onBlur="this.style.backgroundColor='#FFFFFF'" value="" size="30" maxlength="10">                      </td>
                    </tr>
                    <tr> 
                      <td style="color:#999900;">QQ:</td>
                      <td width="6"></td>
                      <td>
                        <input  name=QQ type=text class="inp_set1" id="QQ" onFocus="this.style.backgroundColor='#fffdf7'" onBlur="this.style.backgroundColor='#FFFFFF'" size="30" maxlength="14">                      </td>
                    </tr>
                    <tr> 
                      <td style="color:#999900;">信箱:</td>
                      <td width="6"></td>
                      <td><input  name=email type=text class="inp_set1" id="email" onFocus="this.style.backgroundColor='#fffdf7'" onBlur="this.style.backgroundColor='#FFFFFF'" size="30" maxlength="30"></td>
                    </tr>
                    <tr>
                      <td style="color:#999900;">主页:</td>
                      <td></td>
                      <td><input  name=web type=text class="inp_set1" id="web" onFocus="this.style.backgroundColor='#fffdf7'" onBlur="this.style.backgroundColor='#FFFFFF'" value="http://" size="30" maxlength="40"></td>
                    </tr>
                    <tr>
                      <td style="color:#999900;">验证码:</td>
                      <td></td>
                      <td><input  name=rand type=text class="inp_set1" id="rand" onFocus="this.style.backgroundColor='#fffdf7'" onBlur="this.style.backgroundColor='#FFFFFF'" size="6" maxlength="4">
                        <img src="image.jsp" width="60" height="20"></td>
                    </tr>
                    </tbody> 
                  </table>
                </td>
              </tr>
              <tr> 
                <td colspan="3" align="center" height="30" valign="middle"> 
                  <table border="0" cellpadding="0" cellspacing="0">
                    <tbody> 
                    <tr> 
                      <td style="color:#999900;">性别</td>
                      <td width="6"></td>
                      <td><select name="p1" size="1" onChange="showimage()">
                        <option value="m">男生</option>
                        <option value="w">女生</option>
                      </select></td>
                      <td width="9"></td>
                      <td style="color:#999900;">头像</td>
                      <td width="6"> 
                        <select name="p2" size=1 onChange="showimage()">
                          <option value="01">01</option>
                          <option value="02">02</option>
                          <option value="03">03</option>
                          <option value="04">04</option>
                          <option value="05">05</option>
                          <option value="06">06</option>
                          <option value="07">07</option>
                          <option value="08">08</option>
                        </select>                      </td>
                      <td>&nbsp;</td>
                    </tr>
                    </tbody> 
                  </table>
                  
                </td>
              </tr>
              </tbody> 
            </table>
            <textarea name="text" cols="55" rows=8 wrap="soft" class="inp_set1" id="text" onFocus="this.style.backgroundColor='#fffdf7'" onBlur="this.style.backgroundColor='#FFFFFF'"></textarea>
            <table cellpadding="0" cellspacing="0">
              <tbody> 
              <tr> 
                <td valign="middle"> 
                  <input type="submit" value="我写好咯" class="inp_set1" onFocus="this.style.backgroundColor='#fffdf7'" onBlur="this.style.backgroundColor='#FFFFFF'" name="submit">
                </td>
                <td width="5"></td>
                <td valign="middle"> 
                  <input type="reset" value="重写一回" class="inp_set1" onFocus="this.style.backgroundColor='#fffdf7'" onBlur="this.style.backgroundColor='#FFFFFF'" name="reset">
                </td>
              </tr>
              </tbody> 
            </table>
            <table border="0" cellpadding="0" cellspacing="0">
              <tbody> 
              <tr> 
                <td valign="bottom" align="left"><img src="img\Fi_har.gif" width="28" height="20" border="0" align="middle"><img src="img\Fi_jo.gif" width="37" height="26" border="0" align="middle" hspace="3"></td>
                <td width="300" height="29" align="center" valign="bottom"> 
                  <table border="0" cellpadding="0" cellspacing="0" width="197">
                    
                  </table>
                </td>
                <td valign="bottom" align="right"><img src="img\Fi_hasa.gif" width="24" height="23" border="0" hspace="4" align="bottom"><img src="img\Fi_sc.gif" width="24" height="22" border="0" vspace="3" align="top"></td>
              </tr>
              </tbody> 
            </table>
          </td>
          <td width="12" background="img/frame_tcr.gif"></td>
        </tr>
        <tr> 
          <td valign="top" colspan="3"><img src="img\frame_tcb.gif" width="500" height="12" border="0"></td>
        </tr>
        </tbody> 
      </table>
    </div>
</form>

</td>
      </tr>

      <tr>

        <td>
	<%
  rs.absolute(start);
  rs.previous();

⌨️ 快捷键说明

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