struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <markus.colo...@thales-is.ch>
Subject RE: multipart/form-data problem
Date Thu, 13 Sep 2001 07:26:17 GMT
Thanks for your answer...

...but it won't solve my problem.
I would like to have a form with a file upload and the struts validation.
I'd like to use <html:form enctype=multipart/form-data ...>
And as soon as I use this enctype, the request params get lost in case of an
error :-(
When validation is OK, everything is fine, but when validation fails and the
browser is redirected to the input form, the request params are missing.

Thanks

Markus

-----Original Message-----
From: Michael Nash [mailto:mnash@jcorporate.com]
Sent: Mittwoch, 12. September 2001 16:41
To: struts-dev@jakarta.apache.org
Subject: RE: multipart/form-data problem


Markus:

I did experience a problem with the upload functionality and large binary
files in Struts 1.0. I can't speak for the most current CVS though - it may
well be fixed.

I'm using the uploader class from Turbine instead, which plugs in reasonably
easily to Struts, and doesn't show any problems with large binary files.

Regards,

Mike
Jcorporate Ltd.
http://www.jcorporate.com

> -----Original Message-----
> From: markus.colombo@thales-is.ch [mailto:markus.colombo@thales-is.ch]
> Sent: Wednesday, September 12, 2001 8:25 AM
> To: struts-dev@jakarta.apache.org
> Subject: FW: multipart/form-data problem
>
>
> It seems that no user experienced this problem before?
>
> So I thought I'll ask the question on the dev list before trying
> to dig into
> the source code of struts...
>
> Is there a known limitation/problem with request attributes together with
> multipart/form-data forms?
>
> Thanks
>
> Markus
>
>
> -----Original Message-----
> From: markus.colombo@thales-is.ch [mailto:markus.colombo@thales-is.ch]
> Sent: Montag, 10. September 2001 12:03
> To: struts-user@jakarta.apache.org
> Subject: multipart/form-data problem
>
>
> Hi,
>
> we implemented a JSP with a multipart/form-data form.
> Everything seems to work fine except in the case when our form returns an
> error on validation. We have a request parameter (GPKUpdate) to tell if we
> do a update to an existing record or if we add a new record.
> When our form bean adds an error during validation and the Entryform is
> (should be) displayed again, the parameter is missing from the request:
>
> Root cause of ServletException
> javax.servlet.jsp.JspException: No parameter GPKUpdate was
> included in this
> request
>  	at
> org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:149)
>
> If we remove the enctype='multipart/form-data' attribute of the form (and
> the html:file tag) error handling is working.
>
> Are we missing something? It seems that the request parameters get lost in
> case of an error in validation, but only when using
> enctype='multipart/form-data' ?
>
> We tried with 1.0 and the nightly build with the same effect.
>
> Thanks for any input
>
> Markus Colombo
> Thales Information Systems
>
>
> Here is the relevant code of our .jsp file:
>
>
> <%@ page language="java" %>
> <%@ taglib uri="/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/struts-logic.tld" prefix="logic" %>
> <%@ taglib uri="/struts-bean.tld" prefix="bean" %>
>
> <bean:parameter id='GPK2Update' name='GPKUpdate'/>
> <font color='red'><html:errors/></font><br>
> <center>
> <html:form action="articleEntry" enctype='multipart/form-data'
> method='post'>
> <html:hidden property="GPKUpdate"/>
> <table width="100%" cellspacing="0" cellpadding="0">
> <tr>
>   <td width="30%">
> <bean:message key="articleEntry.articleQTY"/>
>   </td>
>   <td>
> <html:text property="articleQTY" size="16" maxlength="16"/>
>   </td>
> </tr>
> <tr>
>   <td width="30%">
> <bean:message key="articleEntry.articlePicture"/>
>   </td>
>   <td>
>     <html:file property="articlePicture" ACCEPT="*.gif,*.jpg,*.jpeg"/>
>   </td>
>   <td>
>     <input type="button" value="View" onclick="viewPicture()">
>   <logic:notEqual name='GPK2Update' value=''>
>     <html:hidden property='articlePictureName'/>
>     <bean:parameter id='articlePictureName' name='articlePictureName'/>
>     <img border='0' width='75' height='75' name='articlePistureView'
> src=<bean:write name='articlePicturePath'/>/<bean:write
> name='articlePictureName'/>>
>   </logic:notEqual>
>   <logic:equal name='GPK2Update' value=''>
>     <img border='0' width='75' height='75' name='articlePistureView'
> src="../images/transparent.gif">
>   </logic:equal>
>   </td>
> </tr>
> </table>
>   <logic:equal name='GPK2Update' value=''>
>   <html:hidden property='action' value='INSERT'/>
>     <html:submit onclick="return confirmInsert()">
>       <bean:message key="button.Insert"/>
>     </html:submit>
>   </logic:equal>
>   <logic:notEqual name='GPK2Update' value=''>
>     <html:hidden property='action' value='UPDATE'/>
>     <html:submit onclick="return confirmUpdate()">
>       <bean:message key="button.Update"/>
>     </html:submit>
>   </logic:notEqual>
> <html:text property="GPKUpdate"/>
>
> <html:reset>
> <bean:message key="button.Reset"/>
> </html:reset>
> </center>
> </html:form>


Mime
View raw message