Did either of you try specifying the context cleanup
filter?

<filter>
  <filter-name>contextCleanup</filter-name>
  <filter-class>
    org.apache.struts2.dispatcher.ActionContextCleanUp
  </filter-class>
</filter>

and put it first in the filter mapping.

I have yet to have any issues w/ file upload since
including that and I still think I vaguely recall a
thread about this a long time ago but can no longer
find any references to it, so I could be way off-base.

d.

--- torben <[EMAIL PROTECTED]> wrote:

> I cannot help you. But I have exactly the same
> problem. Sometimes it 
> seems that, the execute method is called before the
> HTTP client has 
> finished uploading the file. This results in a null
> value for the File 
> object upload.
> 
> But the file is uploaded, the problem is just, he
> the execute methd is 
> called to fast.
> 
> I try to use Apache webserver as frontend (by the
> use of the mod_jk 
> module), and here I have the problem almost the
> time. Is there some 
> time-out parameters one can set?
> 
> I am using JBOSS as Application server (version
> 4.0.5) and struts 2.0.6.
> 
> 
> 
> best regards
> 
> Torben Frøberg
> Fasanvænget 484
> Tlf. privat 49 14 05 85
> Tlf. arbejde 45 17 12 97
> 
> 
> Kurapica wrote:
> > Hi all,
> >
> > I am using struts 2.0.6 and encountered a submit
> problem.
> >
> > I have a form with enctype="multipart/form-data"
> property. there're
> > other text fields beside <s:file>. when I submit,
> at most time it
> > works fine, but I found that occasionally all
> fields are null. I have
> > replaced commons-fileupload, commons-io and
> commons-collections with
> > latest versions and the problem still exists.
> >
> > struts version is 2.0.6
> > jdk version is 1.5.0_11
> > tomcat version is 5.5.12
> > commons-fileupload version is 1.2
> > commons-collections version is 3.2
> > commons-io version is 1.3.1
> >
> > I provided jspfile, struts.xml and action class
> below. If any
> > infomation required, please reply.
> >
> > Any suggestion is welcome and thanks for your
> advice~
> >
> > This is my jsp file:
> >
> > ----------------------jsp file
> begin----------------------
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
> > <%@ page contentType="text/html; charset=UTF-8" %>
> > <%@ taglib prefix="s" uri="/struts-tags" %>
> > <%@ include file="/WEB-INF/jsp/inc/head_code.jsp"
> %>
> >
>
<%if(!isLoggedIn)response.sendRedirect("./Login.jsp");%>
> > <html>
> > <head>
> >     <link href="<s:url value='/style.css'/>"
> rel="stylesheet" 
> > type="text/css">
> >     <link href="<s:url
> value='/style-kurapica-temp.css'/>"
> > rel="stylesheet" type="text/css">
> >    <title>Shoutloud Add Item Page</title>
> >
> > </head>
> >
> > <body>
> > <center>
> > <s:form action="add_item.action" method="POST" 
> > enctype="multipart/form-data">
> >     <s:property value="message"/>
> >     <s:bean
> name="com.shoutloud.ui.beans.ItemTypesBean"
> id="types">
> >         <s:select label="Item Type"
> name="itemType" value="%{1}"
> > list="#types" required="true"
> requiredposition="left"  />
> >     </s:bean>
> >     <s:textfield label="Item Name" key="name"
> required="true"
> > requiredposition="left"/>
> >     <s:textfield label="Item Desctiption"
> key="description"/>
> >     <s:textfield label="Price in US$(e.g.:1.99)"
> key="price"
> > required="true" requiredposition="left"/>
> >     <s:file name="upload" label="File"
> required="true" 
> > requiredposition="left"/>
> >     <tr><td colspan="2" align="center">
> >    <s:submit theme="simple"/>
> >    </td></tr>
> > </s:form>
> > </center>
> > </body>
> > </html>
> > ----------------------jsp file
> end----------------------
> >
> > This is part of my struts.xml
> >
> > ----------------------struts.xml
> begin----------------------
> > <action name="preadd_item" class="preaddItem">
> >  <result
> name="success">/WEB-INF/jsp/add_item.jsp</result>
> > </action>
> >
> > <action name="add_item" class="addItem">
> >  <result name="success"
> type="redirect-action">show_item</result>
> >  <result
> name="input">/WEB-INF/jsp/add_item.jsp</result>
> > </action>
> > ----------------------struts.xml
> end----------------------
> >
> > This is my action file
> >
> > ----------------------action
> begin----------------------
> > package com.shoutloud.action.user;
> >
> > import java.io.File;
> > import java.io.FileInputStream;
> > import java.io.FileOutputStream;
> >
> > import javax.servlet.http.HttpServletRequest;
> >
> > import org.apache.struts2.ServletActionContext;
> > import
> org.apache.struts2.interceptor.ServletRequestAware;
> >
> > import sun.util.logging.resources.logging;
> >
> > import com.opensymphony.xwork2.ActionSupport;
> > import com.shoutloud.model.Item;
> > import com.shoutloud.model.MusicItem;
> > import com.shoutloud.service.AddItemService;
> > import
> com.shoutloud.service.impl.LoginServiceImpl;
> >
> > public class AddItemAction extends ActionSupport
> implements
> > ServletRequestAware {
> >
> >     private static final long MAX_UPLOAD_SIZE =
> 0x2000000L;
> >
> >     private String itemType;
> >
> >     private String description;
> >
> >     private Double price;
> >
> >     private String url;
> >
> >     private String name;
> >
> >     private AddItemService addItemService;
> >
> >     private HttpServletRequest request;
> >     
> >     private String contentType;
> >
> >     private File upload;
> >
> >     private String fileName;
> >     
> >
> >     public void setAddItemService(AddItemService
> addItemService) {
> >         this.addItemService = addItemService;
> >     }
> >
> >     public void
> setServletRequest(HttpServletRequest 
> > httpServletRequest) {
> >         this.request = httpServletRequest;
> >     }
> >
> 
=== message truncated ===



 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to