hi;
i think the oreilly package is your best choice as for now.
it is very mature, and i used it in very large scale project.
the commons-upload still is missing some stuff such as support for non
western europian characters that are sent as the content of form fields that
are not files (such as a text box/field content ).

-----Original Message-----
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 4:00 PM
To: Tomcat Users List
Subject: RE: How to Upload a File Using JSP?.(Snippest of code needed)



Hola,
Cos.jar works but it's not as actively developed as fileupload and I
don't like it as much anyways.  If
http://jakarta.apache.org/commons/fileupload/using.html and
http://www.cs.tut.fi/~jkorpela/forms/file.html together aren't enough
help for you, then I don't know what else to suggest ;)

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Maruthi [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, August 10, 2004 9:57 AM
>To: Tomcat Users List
>Subject: RE: How to Upload a File Using JSP?.(Snippest of code needed)
>
>Hello,
>Thanks for your reply.I could download the cos.jar from the given
>webiste.Then later onwards i am not able to proceed....i mean how to
>provide the functionality of uploading into my JSP.My JSP contains two
>textboxes and now i have to include the functionality of
uploading.Please
>help me how to proceed.
>
>Thanks for your time and patience,
>Maruthi.
>
>
>
>===================================================
>My JSP Code::
>=====================================================
>
><%@ 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'
>%>
><%@ page import="org.apache.commons.fileupload.*" %>
>
>
>  <%
>  try
>  {
>
>   if(request.getMethod().equals("POST"))
>   {
>
>        RunData rundata=(RunData)request.getAttribute("rundata");
>               String jspeid = (String)
request.getAttribute("js_peid");
>
>        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
","r
>oot","");
>       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+"<br>");
>
>
>               out.println( "<HTML><HEAD><TITLE>Confirmation-Added Grid
>Nodes</TITLE></HEAD>" );
>             out.println( "<BODY bgcolor=blue text=white><br>");
>             out.println( "<h2 align=center><FONT
face=Verdana,Geneva,Arial
>color=white size=4><b>ADD JOBS</b></font></h2>");
>             out.println("<FONT face=Verdana,Geneva,Arial  size=1>");
>
>             out.println( "<table align=center><br>");
>             out.println("<tr><td><b>The Details Belongs to
>Job:&nbsp;</td><td></td><td>"+cpu1+" &nbsp;is added to the
>Database..!.</b></td></tr><br>");
>
>             out.println("</table>");
>             out.println("</font>");
>             out.println("</BODY>");
>             out.println("</HTML>");
>
>       st.close();
>       con.close();
>
>
>      }else
>      {
>  %>
>   <body bgcolor=blue text=white>
>   <form action="SubmitJobs.jsp" enctype="multipart/form-data"
>method="POST"><br><br>
>   <FONT face=Verdana,Geneva,Arial color=white size=1>
>   <br>
>   <h2 align="center"><FONT face=Verdana,Geneva,Arial color=white
>size=4><b>SUBMIT JOBS</b></font></h2>
>   <br>
>   <center>
>
>   <table   align="center" >
>        <tr>
>             <td><b><FONT face=Verdana,Geneva,Arial color=white
>size=2>CPU:<sup>*</sup></FONT></b></td>
>             <td>&nbsp;</td><td>&nbsp;</td>
>             <td><input type="text" name="cpu" value="" size="20"></td>
>            </tr>
>
>        <tr>
>            <td><b><FONT face=Verdana,Geneva,Arial color=white
>size=2>Architecture:<sup>*</sup></FONT></b></td>
>            <td>&nbsp;</td><td>&nbsp;</td>
>         <td><input type="text" name="architecture" value=""
>size="20"></td>
>        </tr>
>
>    <tr>
>            <td><b><FONT face=Verdana,Geneva,Arial color=white
>size=2>Execute PBS File:<sup>*</sup></FONT></b></td>
>            <td>&nbsp;</td><td>&nbsp;</td>
>            <td><INPUT TYPE="file" NAME="fileToUpload"></td</td>
>    </tr>
>
>
>
>
>
>   </table>
>   <br><br>
>
>   <input type="submit" value="Submit" />
>
>
>   </center>
>   </font>
>   </form>
>   </body>
>
>
><%
>   } //else
>   }catch (Exception e)
>   {
>      Log.error(e);
>     return;
>  }
>%>
>
>Rowland Watkins <[EMAIL PROTECTED]> wrote:
>Maruthi,
>
>I found the commons fileupload to be a bit heavy. You could try the
>O'Reilly Upload Servlet:
>
>http://www.servlets.com/resources/com.oreilly.servlet/
>
>This has a simpler API. Just specify the directory for the file being
>uploaded and it does the rest. If you require multiple files to be
>uploaded it may be more suitable to use Struts.
>
>Cheers,
>
>Rowland
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! Mail is new and improved - Check it out!



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to