view_0005fmessage_0002ejsp_jsp.java
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:7k
源码类别:

Jsp/Servlet

开发平台:

VBScript

  1. import java.sql.*;
  2. import javax.servlet.*;
  3. import javax.servlet.http.*;
  4. import javax.servlet.jsp.*;
  5. import org.apache.jasper.runtime.*;
  6. public class view_0005fmessage_0002ejsp_jsp extends HttpJspBase {
  7.     static {
  8.     }
  9.     public view_0005fmessage_0002ejsp_jsp( ) {
  10.     }
  11.     private static boolean _jspx_inited = false;
  12.     public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
  13.     }
  14.     public void _jspService(HttpServletRequest request, HttpServletResponse  response)
  15.         throws java.io.IOException, ServletException {
  16.         JspFactory _jspxFactory = null;
  17.         PageContext pageContext = null;
  18.         HttpSession session = null;
  19.         ServletContext application = null;
  20.         ServletConfig config = null;
  21.         JspWriter out = null;
  22.         Object page = this;
  23.         String  _value = null;
  24.         try {
  25.             if (_jspx_inited == false) {
  26.                 synchronized (this) {
  27.                     if (_jspx_inited == false) {
  28.                         _jspx_init();
  29.                         _jspx_inited = true;
  30.                     }
  31.                 }
  32.             }
  33.             _jspxFactory = JspFactory.getDefaultFactory();
  34.             response.setContentType("text/html; charset=GBK");
  35.             pageContext = _jspxFactory.getPageContext(this, request, response,
  36.              "", true, 8192, true);
  37.             application = pageContext.getServletContext();
  38.             config = pageContext.getServletConfig();
  39.             session = pageContext.getSession();
  40.             out = pageContext.getOut();
  41.             // HTML // begin [file="/view_message.jsp";from=(0,48);to=(1,0)]
  42.                 out.write("rn");
  43.             // end
  44.             // HTML // begin [file="/view_message.jsp";from=(1,31);to=(9,0)]
  45.                 out.write("rn<HTML>rn<HEAD>rn<TITLE> show the message in the table </TITLE>rn</HEAD>rn<BODY>rn<p align="center">所有访客留言</p>rn<hr>rn");
  46.             // end
  47.             // begin [file="/view_message.jsp";from=(9,2);to=(35,0)]
  48.                 
  49.                 try
  50.                 {
  51.                 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  52.                 String url="jdbc:odbc:dsn112";
  53.                 Connection con=DriverManager.getConnection(url,"insher","insher");
  54.                 Statement stm=con.createStatement();
  55.                 ResultSet result=stm.executeQuery("select count(*) from message");
  56.                 int message_count=0;
  57.                 if(result.next())
  58.                 {
  59.                 message_count=result.getInt(1);
  60.                 result.close();
  61.                 }
  62.                 if(message_count>0)
  63.                 {
  64.                 result=stm.executeQuery("select * from message order by time desc");
  65.                 while(result.next())
  66.                 {
  67.                 String title=result.getString("title");
  68.                 String name=result.getString("name");
  69.                 String mail=result.getString("mail");
  70.                 Timestamp time=result.getTimestamp("time");
  71.                 Date date_time=new Date(time.getTime());
  72.                 Time time_time=new Time(time.getTime());
  73.                 String content=result.getString("content");
  74.             // end
  75.             // HTML // begin [file="/view_message.jsp";from=(35,2);to=(38,14)]
  76.                 out.write("rn<TABLE width="100%" align="center" border=1 cellspacing="0" cellpadding="0" bordercolordark="#000000" bordercolorlight="#88a6dd">rn<tr><td bgcolor="#88a6dd"><font size=2>主题:</font></td>rn<td colspan=3>");
  77.             // end
  78.             // begin [file="/view_message.jsp";from=(38,17);to=(38,22)]
  79.                 out.print(title);
  80.             // end
  81.             // HTML // begin [file="/view_message.jsp";from=(38,24);to=(40,4)]
  82.                 out.write("</td></tr>rn<tr><td bgcolor="#88a6dd"><font size=2>留言人:</font></td>rn<td>");
  83.             // end
  84.             // begin [file="/view_message.jsp";from=(40,7);to=(40,11)]
  85.                 out.print(name);
  86.             // end
  87.             // HTML // begin [file="/view_message.jsp";from=(40,13);to=(42,0)]
  88.                 out.write("</td><td bgcolor="#88a6dd"><font size=2>E-mail:</font></td>rn<td>rn");
  89.             // end
  90.             // begin [file="/view_message.jsp";from=(42,2);to=(44,0)]
  91.                 
  92.                 out.println("<a href=mailto:"+mail+">"+mail+"</a>");
  93.             // end
  94.             // HTML // begin [file="/view_message.jsp";from=(44,2);to=(47,0)]
  95.                 out.write("rn</td></tr>rn<tr><td bgcolor="#88a6dd"><font size=2>留言时间:</font></td><td colspan=3>rn");
  96.             // end
  97.             // begin [file="/view_message.jsp";from=(47,2);to=(49,0)]
  98.                 
  99.                 out.println("<font size=2>"+date_time+" "+time_time+"</font>");
  100.             // end
  101.             // HTML // begin [file="/view_message.jsp";from=(49,2);to=(52,0)]
  102.                 out.write("rn</td></tr>rn<tr><td align="center">rn");
  103.             // end
  104.             // begin [file="/view_message.jsp";from=(52,2);to=(54,0)]
  105.                 
  106.                 out.println("("+message_count+")");
  107.             // end
  108.             // HTML // begin [file="/view_message.jsp";from=(54,2);to=(56,14)]
  109.                 out.write("rn</td>rn<td colspan=3>");
  110.             // end
  111.             // begin [file="/view_message.jsp";from=(56,17);to=(56,24)]
  112.                 out.print(content);
  113.             // end
  114.             // HTML // begin [file="/view_message.jsp";from=(56,26);to=(59,0)]
  115.                 out.write("rn</td></tr>rn</table>rn");
  116.             // end
  117.             // begin [file="/view_message.jsp";from=(59,2);to=(73,0)]
  118.                 
  119.                 out.println("<hr>");
  120.                 message_count--;
  121.                 }
  122.                 result.close();
  123.                 con.close();
  124.                 }
  125.                 else
  126.                 {
  127.                 out.println("目前还没有任何留言!");
  128.                 con.close();
  129.                 }
  130.                 } catch(Exception e)
  131.                 {out.println(e);}
  132.             // end
  133.             // HTML // begin [file="/view_message.jsp";from=(73,2);to=(78,0)]
  134.                 out.write("rn<p align="center"><a href="index1.jsp">我要留言</a></p>rn</body>rn</html>rnrn");
  135.             // end
  136.         } catch (Throwable t) {
  137.             if (out != null && out.getBufferSize() != 0)
  138.                 out.clearBuffer();
  139.             if (pageContext != null) pageContext.handlePageException(t);
  140.         } finally {
  141.             if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
  142.         }
  143.     }
  144. }