struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martin.coo...@tumbleweed.com
Subject Re: multipart/form-data problem
Date Fri, 14 Sep 2001 03:53:56 GMT
Are you talking about request attributes, or request parameters? In your
original message, you talk about parameters, but in your follow-up you talk
about attributes.

Request attributes will be lost after the page is first displayed, so will
not be present when the page is redisplayed after a validation error.
Request parameters will be there as long as your page includes some means of
sending them from the browser.

I noticed that the exception you are seeing is being thrown from the
<template:insert> tag. Are you sure this problem is a result of the
multipart data, and not the fact that you are using templates?

--
Martin Cooper


----- Original Message -----
From: <markus.colombo@thales-is.ch>
To: <struts-dev@jakarta.apache.org>
Sent: Wednesday, September 12, 2001 5:25 AM
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