⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tianjia.java

📁 个人办公平台,用JAVA开发的TOMCAT的服务器
💻 JAVA
字号:
/*
 * Created on 2006-9-22
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package com.skyhawk.selffile;

import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.skyhawk.db.ConnectionFactory;

/**
 * @author Administrator
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class Tianjia {
      public void execute(HttpServletRequest request,HttpServletResponse response){
      	      try {
				request.setCharacterEncoding("GBK");
			} catch (UnsupportedEncodingException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
      	     String jieshao=request.getParameter( "jieshao");
      	     System.out.println("+++++++++++"+jieshao);
      	     String file=request.getParameter( "file");
	  	      String filePath="c:/aaa/"+file+"";
	  	     filePath=filePath.toString();//中文转换
	  	     File myFilePath= new File(filePath);
	        	if(!myFilePath.exists())
	  	       myFilePath.mkdir();
      	      Connection conn=ConnectionFactory.getConnection();
      	      Statement stmt=null;
      	      ResultSet rs=null;
      	      HttpSession hs=request.getSession();
      	      String empid=(String)hs.getAttribute("user");
      	      System.out.println("用户ID"+empid);
      	      System.out.println("tianjia ================");
      	      try {
				stmt=conn.createStatement() ;
				String kk="insert into O_file values('"+file+"', '"+" "+"','"+filePath+"','"+empid+"','"+jieshao +"','"+" 0"+"')";
				System.out.println("insert into ====================");
				
				rs=stmt.executeQuery(kk);
				System.out.println("kkkkkkkkkk");
				
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			try {
				request.getRequestDispatcher( "/fanhui.jsp").forward( request,response);
			} catch (ServletException e2) {
				// TODO Auto-generated catch block
				e2.printStackTrace();
			} catch (IOException e2) {
				// TODO Auto-generated catch block
				e2.printStackTrace();
			}
      	      
      	      
      }
}

⌨️ 快捷键说明

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