File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes uploading doc file Using jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "uploading doc file Using jsp" Watch "uploading doc file Using jsp" New topic
Author

uploading doc file Using jsp

aashu sahu
Greenhorn

Joined: Aug 02, 2012
Posts: 1
Hi all m using eclipse as IDE and developing an jsp to upload an doc file. I'm getting an string index out of range exception...... :cry:
Here is code


help me out........
Regards,
rockydroid




getting exception:
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /insert.jsp at line 50

47: }
48: String file = new String(dataBytes);
49: saveFile = file.substring(file.indexOf("filename=\"") + 10);
50: saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
51: saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1,saveFile.indexOf("\""));
52: int lastIndex = contentType.lastIndexOf("=");
53: String boundary = contentType.substring(lastIndex + 1,contentType.length());


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
java.lang.String.substring(Unknown Source)
org.apache.jsp.insert_jsp._jspService(insert_jsp.java:112)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.33 logs.

 
 
subject: uploading doc file Using jsp
 
Similar Threads
how to apply theme as ajax to the jsp form with struts2-core-2.1.6.jar used struts 2 application ?
Unable to load tag handler class "com.opensymphony.webwork.views.jsp.PropertyTag
whats wrong with this code?
creating website basic question
Unable to compile class for JSP