leaveword.jsp

来自「JSP+ORACLE网站开发实例(下).rar」· JSP 代码 · 共 103 行

JSP
103
字号
<%@ include file="conn.jsp"%>
<%request.setCharacterEncoding("GB2312");
 String user_id1= (String) session.getValue("user_id"); 
//叛断Session变量是否超时
if((user_id1==null)|(user_id1=="")){
response.sendRedirect("timeout.htm"); 
}

String user_id2="1";
if(user_id1.equals(user_id2)){
  response.sendRedirect("notreg.htm");
}

String user_id =request.getParameter("user_id");
String netname =request.getParameter("netname");

String sql="select * from scott.larchives where user_id='"+user_id1+"' "; 
ResultSet rs_lar=stmt.executeQuery(sql); 
   if(rs_lar.next()){
netname  =rs_lar.getString("netname");

String word   =request.getParameter("word");

if(word!=null){

	stmt.executeUpdate("INSERT INTO scott.leaveword(id,netname,word,for_id,user_id) VALUES(scott.leavewordid.nextval,'"+netname+"', '"+word+"','"+user_id+"','"+user_id1+"')");
  out.print("<script language='javascript'>");
   out.print("history.go(-2);");
   out.print("</script>");
}
   }
%>

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>签写留言</title>
<style>
<!--
tr           { font-size: 10pt }
body         { font-size: 10pt }
a:link       { color: blue; text-decoration: none }
a:visited    { color: blue; text-decoration: none }
a:active     { color: #ff9966; text-decoration: none }
a:hover      { color: red; text-decoration: none }
-->
</style>

</head>

<body>
<form>
<input type="hidden" name="user_id" value="<%=user_id%>">
<div align="center">
    <table border="0" cellspacing="1" height="111" cellpadding="0" bgcolor="#000000" width="95%">
      <tr bgcolor="#990000"> 
        <td height="25"> 
          <p align="center"><b><font color="#FFFFFF">写留言</font></b> <font color="#FFFF00">[不超过1000个字符]</font> 
        </td>
    </tr>
      <tr bgcolor="#FFFFCC"> 
        <td height="90"> 
          <table border="0" cellspacing="0" height="45" bgcolor="#DDF9FF" cellpadding="5" width="100%">
            <tr> 
              <td height="25">您的网名:</td>
              <td height="25"> 
                <input type="text" name="netname" size="20" value="<%=netname%>" disabled>
              </td>
            </tr>
            <tr> 
              <td height="1" valign="top" colspan="2">
                <hr size="1" noshade>
              </td>
            </tr>
            <tr> 
              <td valign="top">留言内容:</td>
              <td valign="top"> 
                <textarea rows="12" name="word" cols="80" wrap="hard"></textarea>
              </td>
            </tr>
            <tr> 
              <td colspan="2" valign="middle" align="center"> 
                <p> 
                  <input type="submit" value="提交" name="B1">
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  <input type="reset" value="重写" name="B2">
              </td>
            </tr>
          </table>
      </td>
    </tr>
  </table>
</div>
</form>

</body>

</html>

⌨️ 快捷键说明

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