xinwen2_jsp.java

来自「JAVA实验图形 =各种 的 JAVA简单代码 出初学者必备!!!!!!!!!」· Java 代码 · 共 101 行

JAVA
101
字号
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import java.io.*;
import java.util.*;

public final class xinwen2_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

String xinwenname,xinwentype,xinwenshuoming;
  private static java.util.Vector _jspx_dependants;

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  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;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=GBK");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write('\n');
      out.write('\n');
      out.write('\n');
request.setCharacterEncoding("gb2312");
      out.write('\n');
      out.write('\n');
Statement stmt=null;    xinwenname=request.getParameter("xinwenname");   xinwentype=request.getParameter("xinwentype");    xinwenshuoming=request.getParameter("xinwenshuoming");//用于获取图皮//String filename=request.getParameter("xinwentupian");//FileInputStream in=new FileInputStream(filename);String sql = "insert into xinwen(xinwenname,xinwentype,xinwenshuoming)  VALUES('" +xinwenname +                  "','"+xinwentype + "','" +xinwenshuoming +"')";try {            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");            //定义JDBC URL        }catch (Exception e) {        out.println(e.getMessage());        }          try{        String url = "jdbc:odbc:s";            //得到与数据库的连接            Connection con = DriverManager.getConnection(url);            //显示UPL和连接信息            System.out.print("URL:" + url);            System.out.print("Connection:" + con);            //得到一个Statement对象            stmt = con.createStatement();            //执行SQL语句            System.out.print("SQL:" + sql);            ResultSet p = stmt.executeQuery(sql);            } catch (Exception e) {}
      out.write('\n');
response.sendRedirect  ("xinwenshow.jsp");
      out.write('\n');
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

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