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

📄 admin.jsp

📁 这也是一个java版的留言版
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" %><%@ include file="../include/config.jsp" %><%@ include file="../include/global.jsp" %><%@ include file="../include/dbUtil.jsp" %><%@ include file="../include/dbConnect.jsp" %><%@ include file="../include/fieldGroup.jsp" %><%!    int ni=7;    String pageLocation="您的位置: <a href='../common/main.php' class=w>酷网首页</a>>>"+navi[ni];%><%boolean isDebug=isDebug(request,false);if(isDebug)out.println("Now it's in DEBUG mode, and the time is "+getDateAndTime(null)+" !<br>");DBConnect dbCon=new DBConnect(dbString,dbClass,dbUser,dbPswd);try{    String theID=request.getParameter("theID");    Hashtable ht=new Hashtable();    if(theID==null)ht.put("theID","null");    else ht.put("theID",theID);    if(isDebug)out.println("ht==null?"+(ht==null)+"<br>");    boolean isLogin=checkRight(response,ht,session,"1",request.getRequestURI());    if(session.getAttribute("hashtable")!=null){        ht=(Hashtable)session.getAttribute("hashtable");    }    if(isDebug){            if(session.getAttribute("mySession")!=null){                Hashtable mySession=(Hashtable)session.getAttribute("mySession");                        out.println("userID=*"+mySession.get("userID")+"*<br>");                        Enumeration enm=session.getAttributeNames();                        while(enm.hasMoreElements()){                            out.println(enm.nextElement()+"<br>");                        }            }            out.println("(session.getAttribute(\"hashtable\")==null)?"+(session.getAttribute("hashtable")==null)+"<br>");            out.println("ht==null?"+(ht==null)+"<br>");    }    if(isLogin)session.removeAttribute("hashtable");    //每页显示的留言条数!    int pageSize=10;    //存放留言的表名    String tableName="web_gbook";    if(theID==null){        Object obj=ht.get("theID");        if(obj!=null)theID=(String)obj;        if(isDebug)out.println("obj=null?"+(obj==null)+"<br>");    }    if(isDebug)out.println("theID=*"+theID+"*<br>");    if(theID==null)alertPage(response,7001,null);    String action=request.getMethod();    if(action.equals("POST")){        String strSQL=null;        String which=request.getParameter("which");        if(which!=null&&which.equals("reply")){            String name=request.getParameter("name");            String subject=request.getParameter("subject");            String content=request.getParameter("content");            String mail=request.getParameter("mail");            String webSite=request.getParameter("webSite");            String theQQ=request.getParameter("oicq");            String theIP=request.getRemoteAddr();            //String date=getDateAndTime("date");            String reply=request.getParameter("reply");            String replyDate=getDateAndTime(null);            strSQL="update "+tableName+" set gbk_name='"+name+"',gbk_subject='"+subject+"',gbk_content='"+content+"',"                  +"gbk_mail='"+mail+"',gbk_webSite='"+webSite+"',gbk_qq='"+theQQ+"',"                  +"gbk_isreply='Y',gbk_reply='"+reply+"',gbk_replydate='"+replyDate+"' where  gbk_id='"+theID+"'";        }        else if(which!=null&&which.equals("delete")){            strSQL="delete from "+tableName+" where gbk_id='"+theID+"'";        }        else{            alertPage(response,7001,null);        }        if(dbCon.doUpdate(strSQL)>0)response.sendRedirect("./index.jsp");        else{            if(isDebug)out.println(strSQL);            else alertPage(response,7003,null);        }    }    else{        //String theUser=request.getParameter("user");        //String thePswd=request.getParameter("pswd");        String strSQL="select * from "+tableName+" where gbk_id='"+theID+"'";        FieldGroup fd=new FieldGroup(dbCon,strSQL);%><%@ include file="../include/header.jsp" %><!--Page Start--><table bgcolor="" "#ffffff" width="100%" cellspacing="0" cellpadding="0" border="0">    <tr><td nowrap align=center width=""><p style="line-height:180%">    <font color=navy>首先感谢你的留言,你的每一句话我都会仔细阅读!!!</font>    </td></tr>    <tr><td align=center bgcolor=#007CD3 colspan=5 height=25><font color=fffff><p style="line-height:160%;font-size:10pt"><b>管理留言<b></font></td></tr>    <tr><td align=center><br><br>      <form name=theForm action="<%=request.getRequestURI()%>" method="post">      <input type=hidden name=which value="reply">      <input type=hidden name=theID value="<%=theID%>">      <table>          <tr>           <td nowrap>您的大名:</td><td><input type="text" name="name" value="<%=fd.getString("gbk_name")%>" size="25"></td>           <td nowrap>OICQ号码:</td><td><input type="text" name="oicq" value="<%=fd.getString("gbk_qq")%>"  size="25"></td>          </tr>          <tr>           <td nowrap>电子邮件: </td><td><input type="text" name="mail" value="<%=fd.getString("gbk_mail")%>" size="25"></td>           <td nowrap>个人主页:</td><td><input type="text" name="webSite" value="<%=fd.getString("gbk_webSite")%>" size="25"></td>          </tr>          <tr><td>            主题:</td><td colspan=3><input type="text" name="subject" size="64"  value="<%=fd.getString("gbk_subject")%>"></td>          </tr>          <tr><td> 内容:</td><td colspan=3><textarea name="content" cols="63" rows="6"><%=fd.getString("gbk_content")%></textarea></td>          </tr>          <tr><td> 回复:</td><td colspan=3><textarea name="reply" cols="63" rows="8" ><%=fd.getString("gbk_reply")%></textarea></td>          </tr>          <tr>            <td colspan=4 align=center><br><br>              <input type="button" value="回复留言" onclick="doSubmit('reply')" style="border:1px dotted #111111; border-collapse: collapse; color:#000000; background-color: #EFEFEF">              <input type="button" value="删除留言" onclick="doSubmit('delete')" style="border:1px dotted #111111; border-collapse: collapse; color:#000000; background-color: #EFEFEF">              <input type="button" value="察看留言" onclick="location.href='./index.jsp'" style="border:1px dotted #111111; border-collapse: collapse; color:#000000; background-color: #EFEFEF">              <input type="button" value="注销身份" onclick="location.href='../include/login.jsp?doing=logout'" style="border:1px dotted #111111; border-collapse: collapse; color:#000000; background-color: #EFEFEF">            </td>          </tr>      </table>      </form>    <br></td></tr></table><!--Page End--><%@ include file="../include/footer.jsp" %><script>    function doSubmit(doWhat){        theForm.which.value=doWhat;        theForm.submit();    }</script><%}}catch(Exception e){alertPage(response,7775,e.toString());}finally{dbCon.close();}%>

⌨️ 快捷键说明

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