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","root","");
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: </td><td></td><td>"+cpu1+" 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> </td><td> </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> </td><td> </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> </td><td> </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!