Bom dia pessoal, estou tentando fazer upload de arquivo através de uns exemplo da net, mas sem sucesso, considerando que o POST está enviando a foto perfeitamente:
Olá Puka, ocorreu erros no construtor das classes:
[code]ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
ServletFileUpload upload = new ServletFileUpload(servletFileUpload);
try {
List items = upload.parseRequest(request);
Iterator iter = items.iterator();
…[/code]
Ocorre este erro:
[code]GRAVE: Servlet.service() for servlet [jsp] in context with path [/ExtJava] threw exception [Unable to compile class for JSP:
An error occurred at line: 12 in the jsp file: /teste.jsp
The constructor ServletFileUpload(DiskFileItemFactory) is undefined
9:
10:
11: <%
12: ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
13: ServletFileUpload upload = new ServletFileUpload(servletFileUpload);
14:
15: try {
An error occurred at line: 13 in the jsp file: /teste.jsp
The constructor ServletFileUpload(ServletFileUpload) is undefined
10:
11: <%
12: ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
13: ServletFileUpload upload = new ServletFileUpload(servletFileUpload);
14:
15: try {
16: List items = upload.parseRequest(request);
Stacktrace:] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 12 in the jsp file: /teste.jsp
The constructor ServletFileUpload(DiskFileItemFactory) is undefined
9:
10:
11: <%
12: ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
13: ServletFileUpload upload = new ServletFileUpload(servletFileUpload);
14:
15: try {
An error occurred at line: 13 in the jsp file: /teste.jsp
The constructor ServletFileUpload(ServletFileUpload) is undefined
10:
11: <%
12: ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
13: ServletFileUpload upload = new ServletFileUpload(servletFileUpload);
14:
15: try {
16: List items = upload.parseRequest(request);
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:95)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:367)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:345)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:342)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:550)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)[/code]