lyb2.jsp
上传用户:mkymky1985
上传日期:2014-06-23
资源大小:754k
文件大小:2k
- <%@ page language = "java" contentType = "text/html;charset=gb2312"%>
- <%@ page import = "java.sql.*" %>
- <jsp:useBean id="subject" scope="page" class="wsxk.ConDB"/>
- <%! String trans(String chi)
- {
- String result = null;
- byte temp [];
- try
- {
- temp=chi.getBytes("iso-8859-1");
- result = new String(temp, "gb2312");
- }
- catch(Exception e)
- {
- System.out.println (e.toString());
- }
- return result;
- }
- %>
- <%
- String strSQL1 = "select mesid from message order by mesid asc";
- ResultSet rs = subject.executeQuery(strSQL1);
- String MaxID = new String();
- int id = 0;
- while(rs.next())
- {
- id = rs.getInt("mesid");
- }
- /*int k = 0;
- for (k = 0; k < 999999; k++)
- {
- if (id.equals(MaxID.valueOf(k)))
- break;
- }
- ++k;
- if (k >= 999999)
- k = 1;
- id = MaxID.valueOf(k);*/
- id++;
- System.out.println("id" + id);
- rs.close();
- %>
- <%
- String content = new String (request.getParameter("textarea"));
- String tempname = new String();
- String sql = "select stuname from student where stuid = '"+session.getValue("wnum")+"'";
- ResultSet rs1=subject.executeQuery(sql);
- while (rs1.next())
- {
- tempname =rs1.getString("stuname");
- }
- rs1.close();
- %>
- <%
- String sql2 = "insert into message(mesid, stuid, stuname, mescontent) values(" + id + ",'" +session.getValue("wnum")+ "','" + tempname + "','" + trans(content) + "')";
- subject.executeUpdate(sql2);
- %>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <meta HTTP-EQUIV=REFRESH CONTENT="10; URL=index1.jsp">
- <link href="_notes/aaa.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- <!--
- @import url("_notes/ccc");
- body,td,th {
- font-size: 12px;
- color: #FFFFFF;
- font-weight: bold;
- }
- a:link {
- color: #000000;
- }
- -->
- </style>
- </HEAD>
- <BODY BGCOLOR=#0D85A6 BACKGROUND="images/bg.gif" >
- <div align="center">
- <p align="left">
- <br>
- 您所的意见已经被提交,谢谢您对我们的支持,本页将于10秒内自动<a href="index1.jsp">返回首页</a></p>
- <p><br>
- <img src="images/qa.jpg" width="640" height="427"></p>
- </div>
- </BODY>
- </HTML>