Ciao a tutti...ho un problemino:
ho fatto una form html contenente 2 campi di testo e un meccanismo per fare l'upload di un file. Dato che per fare l'upload di un file nelle proprietà della form devo settare: enctype="multipart/form-data"

questa mi da problemi per gli altri due campi di testo. Nella jsp che si occupa di prelevare i dati, i campi di testo li recupero così:

String tit = request.getParameter("titolo");
String sot = request.getParameter("sottotitolo");

mentre per quanto riguarda l'upload c'è un meccanismo diverso che è il seguente:

String contentType = request.getContentType();
out.print("Content type is :: " +contentType);
if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength) {
byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
totalBytesRead += byteRead;
}
String file = new String(dataBytes);
String saveFile = file.substring(file.indexOf("filename=\"") + 10);
saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1,saveFile.indexOf("\""));
int lastIndex = contentType.lastIndexOf("=");
String boundary = contentType.substring(lastIndex + 1,contentType.length());
int pos;
pos = file.indexOf("filename=\"");
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;

int boundaryLocation = file.indexOf(boundary, pos) - 4;
int startPos = ((file.substring(0, pos)).getBytes()).length;
int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
//La directory nel quale va salvato il file
saveFile = "C:\\" + saveFile;
FileOutputStream fileOut = new FileOutputStream(saveFile);
fileOut.write(dataBytes, startPos, (endPos - startPos));
fileOut.flush();
fileOut.close();
out.println("File salvato in " +saveFile);

se metto tutto nella stessa form mi da il seguente errore:
exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

root cause

java.lang.NullPointerException
org.apache.jsp.treeProvaPROVA_00201_2.editor.inser t_jsp._jspService(org.apache.jsp.treeProvaPROVA_00 201_2.editor.insert_jsp:121)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


Sapete indicarmi come posso mettere insieme i due campi di testo e il meccanismo per l'upload senza problemi?grazie