Hello.
I got all libraries from
here(http://jakarta.apache.org/commons/fileupload/dependencies.html):
commons-io-1.3.jar
commons-fileupload-1.0.jar
junit.jar(3.8.2)
portlet-api-1.0.jar
And simple example:
FileItemFactory factory = new DefaultFileItemFactory();
FileUpload upload = new FileUpload(factory);
List items = upload.parseRequest(request);
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
out.println(item.getFieldName());
} else {
out.println(item.getFieldName());
}
}
Nothing happend, while whithout NetUI(request directly to jsp) it works
I made similar example whith the latest versions of above libraries, the same
result.
By the way, while writing my previous letter I used
com.oreilly.servlet.multipart instead org.apache.commons.fileupload. The
problem was that I didn`t load commons-io library ;). When I loadded it I got:
java.io.IOException: Corrupt form data: premature ending
(http://unix.org.ua/orelly/java-ent/servlet/ch04_04.htm)
Whithout netui everything is stil ok.
May be you have a working example of a simple fileuploading servlet?
Thanks.
Whith best regard? Mikhail.
>The exception in #2 looks like a dependency issue. What version of
>commons-fileupload do you have? Beehive is built on Struts 1.2.9 which
>ships with commons-fileupload v1.0. It looks like the more recent
>version of commons-fileupload are now dependent on the commons-io. You
>probably need to include this jar with your version of
>commons-fileupload. See...
>
>http://jakarta.apache.org/commons/fileupload/dependencies.html
>
>for the dependencies.
>
>Hope that helps,
>Carlin
>
>On 5/16/07, "Михаил Noofiz" <[EMAIL PROTECTED]> wrote:
>> I tried both ways:
>> 1)I created beehive-netui-config.xml in WEB-INF, the encoding is realy UTF-8:
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <netui-config>
>> <pageflow-config>
>> <multipart-handler>memory</multipart-handler>
>> </pageflow-config>
>> </netui-config>
>>
>> but webapp refused to start:
>>
>> FAIL - Encountered exception java.lang.IllegalStateException: Container
>> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/netui-tutorial]
>> has not been started
>>
>> 2)I removed beehive-netui-config.xml and added to Controller`s annotation:
>>
>> @Jpf.Controller(
>> simpleActions={
>> @Jpf.SimpleAction(name="begin", path="index.jsp")
>> },
>> multipartHandler=Jpf.MultipartHandler.memory
>> )
>>
>> and I got this while uploading file:
>>
>> exception
>>
>> javax.servlet.ServletException: Servlet execution threw an exception
>>
>> root cause
>>
>> java.lang.NoClassDefFoundError:
>> org/apache/commons/io/output/DeferredFileOutputStream
>> org.apache.commons.fileupload.DefaultFileItemFactory.createItem(DefaultFileItemFactory.java:103)
>> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:350)
>> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:302)
>> org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:193)
>> org.apache.beehive.netui.pageflow.MultipartRequestUtils.preHandleMultipartRequest(MultipartRequestUtils.java:209)
>> org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processMultipart(PageFlowRequestProcessor.java:921)
>> org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionOverride(PageFlowRequestProcessor.java:359)
>> org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:469)
>> org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
>> org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
>> org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
>> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>
>>
>> >By default, multipart request handling is disabled. The "NetUI Form
>> >Control Tags" document includes a section on the <netui:fileUpload>
>> >tag and how to enable multipart request handling. See...
>> >
>> >http://beehive.apache.org/docs/1.0.2/netui/tags/formControls.html#FileUpload
>> >
>> >Kind regards,
>> >Carlin
>> >
>> >On 5/12/07, "Михаил Noofiz" <[EMAIL PROTECTED]> wrote:
>> >> Hello.
>> >>
>> >> I`ve got a problem while uploading files with
>> >> com.oreilly.servlet.multipart library.
>> >> from a jsp page I call a class method? which simply shwos the uploaded
>> >> file name.
>> >>
>> >> Wheb I navigate directly to jsp page everything OK:
>> >> <form action="page1.jsp" method="POST" enctype="multipart/form-data">
>> >>
>> >> But when I try to do the same through the action, which just redirects to
>> >> page1.jsp, I get:
>> >> javax.servlet.ServletException: Received a multipart request, but
>> >> multipart handling is not enabled.
>> >>
>> >> Thanks
>> >>
>>
>>
>> --
>> Яндекс.Фотки - заливай свои, любуйся чужими! http://fotki.yandex.ru/
>>
--
Сколько ваших знакомых в МойКруг.ру? http://moikrug.ru/