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 Fri, 14 Sep 2001 11:31:55 GMT
Thank you again for your suggestions.
I rewrote the upload example to do some testing:
- added validate() method to uploadForm
- changed struts-config :validate="true"; input="/upload/upload.jsp"
- modified upload.jsp (I even left off the html:file tag):

<%@ page language="java" %>
<%@ taglib uri="/struts-html.tld" prefix="html" %>
<%@ taglib uri="/struts-bean.tld" prefix="bean" %>

<html:html locale="true">
<head>
<title><bean:message key="index.title"/></title>
<html:base/>
<bean:parameter id='testID' name='test'/>
</head>
<body>
testID:<%=testID%>
<font color='red'><html:errors/></font><br>

<html:form action="upload.do" enctype="multipart/form-data" method="post">
<html:hidden property='test' value='<%=testID%>'/>
<html:text property="filePath" /><br /><br />

<html:submit/>
</html:form>
</body>
</html:html>

But the same thing happens: As soon as the validate method returns an error,
the original request parameter (Sorry for writing attribute in my last
mail...) gets lost:

javax.servlet.jsp.JspException: No parameter test was included in this
request 	at
org.apache.struts.taglib.bean.ParameterTag.doStartTag(ParameterTag.java:174)
at jsp_servlet._upload._upload._jspService(_upload.java:115) 	at
weblogic.servlet.jsp.JspBase.service(JspBase.java:27)

Again, if I remove  enctype="multipart/form-data" from the form tag, my
error message gets displayed properly and the request parameter is set.

Any other suggestion?

-----Original Message-----
From: martin.cooper@tumbleweed.com [mailto:martin.cooper@tumbleweed.com]
Sent: Freitag, 14. September 2001 05:54
To: struts-dev@jakarta.apache.org; markus.colombo@thales-is.ch
Subject: Re: multipart/form-data problem


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



Mime
View raw message