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>

Reply via email to