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

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 add_0005fmessage_0002ejsp_jsp extends HttpJspBase {
  7.     static {
  8.     }
  9.     public add_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;ISO-8859-1");
  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="/add_message.jsp";from=(0,31);to=(6,0)]
  42.                 out.write("rn<HTML>rn<HEAD>rn<TITLE>add message into table </TITLE>rn</HEAD>rn<BODY>rn");
  43.             // end
  44.             // begin [file="/add_message.jsp";from=(6,2);to=(57,0)]
  45.                 
  46.                 String name=request.getParameter("name");
  47.                 String mail=request.getParameter("mail");
  48.                 String title=request.getParameter("title");
  49.                 String content=request.getParameter("content");
  50.                 
  51.                 if(name==null)
  52.                 name="";
  53.                 if(title==null)
  54.                 title="";
  55.                 if(content==null)
  56.                 content="";
  57.                 if(mail==null)
  58.                 mail="";
  59.                 if(name.length()==0)
  60.                 out.println("ÁôÑÔÈËÐÕÃû²»ÄÜΪ¿Õ£¡");
  61.                 else if(title.length()==0)
  62.                 out.println("ÁôÑÔÖ÷Ìâ²»ÄÜΪ¿Õ£¡");
  63.                 else if(content.length()==0)
  64.                 out.println("ÁôÑÔÄÚÈݲ»ÄÜΪ¿Õ£¡");
  65.                 else
  66.                 {
  67.                 java.util.Date date=new java.util.Date();
  68.                 String datetime=new Timestamp(date.getTime()).toString();
  69.                 
  70.                 try
  71.                 {
  72.                 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  73.                 String userName = "sa";
  74.                 String password = "";
  75.                 String URL="";
  76.                 String sql="";
  77.                 String url="jdbc:odbc:dsn112";
  78.                 Connection con=DriverManager.getConnection(url,userName,password);
  79.                 PreparedStatement stm=con.prepareStatement("insert into message values(?,?,?,?,?)");
  80.                 stm.setString(1,title);
  81.                 stm.setString(2,name);
  82.                 if(mail.length()==0)
  83.                 stm.setString(3,null);
  84.                 else stm.setString(3,mail);
  85.                 stm.setString(4,datetime);
  86.                 stm.setString(5,content);
  87.                 try
  88.                 {
  89.                 stm.executeQuery();
  90.                 } catch(Exception e)
  91.                 {}
  92.                 con.close();
  93.                 }
  94.                 catch (Exception e)
  95.                 {}
  96.             // end
  97.             // HTML // begin [file="/add_message.jsp";from=(57,2);to=(58,0)]
  98.                 out.write("rn");
  99.             // end
  100.             // begin [file="/add_message.jsp";from=(58,0);to=(58,39)]
  101.                 if (true) {
  102.                     out.clear();
  103.                     String _jspx_qfStr = "";
  104.                     pageContext.forward("view_message.jsp" +  _jspx_qfStr);
  105.                     return;
  106.                 }
  107.             // end
  108.             // HTML // begin [file="/add_message.jsp";from=(58,39);to=(59,0)]
  109.                 out.write("rn");
  110.             // end
  111.             // begin [file="/add_message.jsp";from=(59,2);to=(61,0)]
  112.                 
  113.                 }
  114.             // end
  115.             // HTML // begin [file="/add_message.jsp";from=(61,2);to=(66,0)]
  116.                 out.write("rn</body>rn</html>rnrnrn");
  117.             // end
  118.         } catch (Throwable t) {
  119.             if (out != null && out.getBufferSize() != 0)
  120.                 out.clearBuffer();
  121.             if (pageContext != null) pageContext.handlePageException(t);
  122.         } finally {
  123.             if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
  124.         }
  125.     }
  126. }