Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 78424 invoked from network); 10 Aug 2004 13:56:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 10 Aug 2004 13:56:48 -0000 Received: (qmail 81358 invoked by uid 500); 10 Aug 2004 13:56:11 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 81267 invoked by uid 500); 10 Aug 2004 13:56:10 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 81254 invoked by uid 99); 10 Aug 2004 13:56:10 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [206.113.192.17] (HELO yorktown.nielsenmedia.com) (206.113.192.17) by apache.org (qpsmtpd/0.27.1) with ESMTP; Tue, 10 Aug 2004 06:56:09 -0700 Received: from NMRUSDUNSXG10.nmrlan.net (nmrusdunsxg10.nmrlan.net [10.38.67.44]) by yorktown.nielsenmedia.com (8.12.10/8.12.8) with ESMTP id i7ADsQXQ029098 for ; Tue, 10 Aug 2004 09:54:26 -0400 (EDT) Received: from nmrusdunsxg2.nielsenmedia.com (unverified) by NMRUSDUNSXG10.nmrlan.net (Content Technologies SMTPRS 4.3.14) with ESMTP id for ; Tue, 10 Aug 2004 09:55:23 -0400 Received: by nmrusdunsxg2.nmrlan.net with Internet Mail Service (5.5.2653.19) id ; Tue, 10 Aug 2004 09:56:27 -0400 Message-ID: From: "Srofe, Douglas (c)" To: "'Tomcat Users List'" Subject: RE: How to Upload a File Using JSP?.(Snippest of code needed) Date: Tue, 10 Aug 2004 09:55:18 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Go to http://jakarta.apache.org/commons. There is a file upload component. -----Original Message----- From: Maruthi [mailto:maruthibabu_2k@yahoo.com] Sent: Tuesday, August 10, 2004 5:05 AM To: tomcat-user@jakarta.apache.org Subject: How to Upload a File Using JSP?.(Snippest of code needed) Hello Everybody, I got some problem regarding file uploading using JSP. In my JSP I have a form which contains 2 textboxes and other text box for uploading a file.I need to store the information of 2 text boxes,uploaded file in the mysql databse.I am looking for the code for uploading a file using JSP. Please see below for my code.In this code i need to include the code for uploading a file. Any help in this regard would be greatly appreciated..Pl reply in this regard. Thank you, Maruthi. ============================= <%@ page language="java" contentType="text/html" %> <%@ page import = "java.io.*" %> <%@ page import = "java.lang.*" %> <%@ page import = "java.sql.*" %> <%@ page import = "org.apache.turbine.util.RunData" %> <%@ page import = "org.apache.turbine.util.Log" %> <%@ page import = "javax.servlet.http.*" %> <%@ taglib uri='/WEB-INF/templates/jsp/tld/template.tld' prefix='jetspeed' %> <%@ <% try { if(request.getMethod().equals("POST")) { String cpu1= request.getParameter("cpu"); String architecture1= request.getParameter("architecture"); Class.forName("org.gjt.mm.mysql.Driver"); Connection con=DriverManager.getConnection("Jdbc:mysql://localhost:3306/Thesiswork","ro ot",""); Statement st=con.createStatement(); String str="INSERT into submitjobs VALUES('"+cpu1+"','"+architecture1+"','"+file1+"')"; int i=st.executeUpdate(str); System.out.println("Number of Rows inserted into AddGridNodes Table is: " +i+"
"); out.println( "Confirmation-Added Grid Nodes" ); out.println( "
"); out.println( "

ADD JOBS

"); out.println(""); out.println( "
"); out.println("
"); out.println("
The Details Belongs to Job: "+cpu1+"  is added to the Database..!.
"); out.println("
"); out.println(""); out.println(""); st.close(); con.close(); }else { %>



SUBMIT JOBS


CPU:*   
Architecture:*   
Execute PBS File:*   


<% } //else }catch (Exception e) { Log.error(e); return; } %> --------------------------------- Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org