add_0005fmessage_0002ejsp_jsp.java
资源名称:JSP02.rar [点击查看]
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:5k
源码类别:
Jsp/Servlet
开发平台:
VBScript
- import java.sql.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import javax.servlet.jsp.*;
- import org.apache.jasper.runtime.*;
- public class add_0005fmessage_0002ejsp_jsp extends HttpJspBase {
- static {
- }
- public add_0005fmessage_0002ejsp_jsp( ) {
- }
- private static boolean _jspx_inited = false;
- public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
- }
- public void _jspService(HttpServletRequest request, HttpServletResponse response)
- throws java.io.IOException, ServletException {
- JspFactory _jspxFactory = null;
- PageContext pageContext = null;
- HttpSession session = null;
- ServletContext application = null;
- ServletConfig config = null;
- JspWriter out = null;
- Object page = this;
- String _value = null;
- try {
- if (_jspx_inited == false) {
- synchronized (this) {
- if (_jspx_inited == false) {
- _jspx_init();
- _jspx_inited = true;
- }
- }
- }
- _jspxFactory = JspFactory.getDefaultFactory();
- response.setContentType("text/html;ISO-8859-1");
- pageContext = _jspxFactory.getPageContext(this, request, response,
- "", true, 8192, true);
- application = pageContext.getServletContext();
- config = pageContext.getServletConfig();
- session = pageContext.getSession();
- out = pageContext.getOut();
- // HTML // begin [file="/add_message.jsp";from=(0,31);to=(6,0)]
- out.write("rn<HTML>rn<HEAD>rn<TITLE>add message into table </TITLE>rn</HEAD>rn<BODY>rn");
- // end
- // begin [file="/add_message.jsp";from=(6,2);to=(57,0)]
- String name=request.getParameter("name");
- String mail=request.getParameter("mail");
- String title=request.getParameter("title");
- String content=request.getParameter("content");
- if(name==null)
- name="";
- if(title==null)
- title="";
- if(content==null)
- content="";
- if(mail==null)
- mail="";
- if(name.length()==0)
- out.println("ÁôÑÔÈËÐÕÃû²»ÄÜΪ¿Õ£¡");
- else if(title.length()==0)
- out.println("ÁôÑÔÖ÷Ìâ²»ÄÜΪ¿Õ£¡");
- else if(content.length()==0)
- out.println("ÁôÑÔÄÚÈݲ»ÄÜΪ¿Õ£¡");
- else
- {
- java.util.Date date=new java.util.Date();
- String datetime=new Timestamp(date.getTime()).toString();
- try
- {
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- String userName = "sa";
- String password = "";
- String URL="";
- String sql="";
- String url="jdbc:odbc:dsn112";
- Connection con=DriverManager.getConnection(url,userName,password);
- PreparedStatement stm=con.prepareStatement("insert into message values(?,?,?,?,?)");
- stm.setString(1,title);
- stm.setString(2,name);
- if(mail.length()==0)
- stm.setString(3,null);
- else stm.setString(3,mail);
- stm.setString(4,datetime);
- stm.setString(5,content);
- try
- {
- stm.executeQuery();
- } catch(Exception e)
- {}
- con.close();
- }
- catch (Exception e)
- {}
- // end
- // HTML // begin [file="/add_message.jsp";from=(57,2);to=(58,0)]
- out.write("rn");
- // end
- // begin [file="/add_message.jsp";from=(58,0);to=(58,39)]
- if (true) {
- out.clear();
- String _jspx_qfStr = "";
- pageContext.forward("view_message.jsp" + _jspx_qfStr);
- return;
- }
- // end
- // HTML // begin [file="/add_message.jsp";from=(58,39);to=(59,0)]
- out.write("rn");
- // end
- // begin [file="/add_message.jsp";from=(59,2);to=(61,0)]
- }
- // end
- // HTML // begin [file="/add_message.jsp";from=(61,2);to=(66,0)]
- out.write("rn</body>rn</html>rnrnrn");
- // end
- } catch (Throwable t) {
- if (out != null && out.getBufferSize() != 0)
- out.clearBuffer();
- if (pageContext != null) pageContext.handlePageException(t);
- } finally {
- if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
- }
- }
- }