您的位置:首页 >> Web开发 >> JSP技术 >> 正文
RSS
 

用jspsmartupload进行上传下载

http://www.rdxx.com 03年06月18日 12:12 Blog 我要投稿

关键词: 上传 , SPS , 下载 , PS

这是进行上传

import java.sql.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.jspsmart.upload.*;

public class UpLoad extends HttpServlet {

    private ServletConfig config;
    /**
     * Init the servlet
     */
    final public void init(ServletConfig config) throws ServletException {
        this.config = config;
    }

    final public ServletConfig getServletConfig() {
        return config;
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("============UpLoad begin ddd=============");
        String id = null;
        SmartUpload mySmartUpload = new SmartUpload();
        PrintWriter out = response.getWriter();
        java.io.File file=null;
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
        } catch (java.lang.ClassNotFoundException e) {
            System.err.print("ClassNotFoundException: " + e.getMessage());
        }

        try {
            //Class.forName("oracle.jdbc.driver.OracleDriver");
            Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@10.216.0.2:1521:ORCL", "test", "test");

            conn.setAutoCommit(false); //设置手动提交,以提高性能。
            Statement stmt = conn.createStatement();
            // Initialization
            mySmartUpload.initialize(config, request, response);

            mySmartUpload.setMaxFileSize(500 * 1024);

            // Upload
            mySmartUpload.upload();

            //取得text框中的数据
            id = mySmartUpload.getRequest().getParameter("id");

9 7 3 1 2 3 4 4 8 :

 
 
标签: 上传 , SPS , 下载 , PS 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站