struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Germuska <...@Germuska.com>
Subject Re: <html:file> tag
Date Thu, 03 Oct 2002 15:40:59 GMT
At 11:09 AM -0400 2002/10/03, Matt Sales wrote:
>Hello,
>I'm having trouble with the <html:file> tag...
>
>Here's a snippet of my jsp:
>
><html:form method="POST" action="/saveAction.do"
>enctype="multipart/form-data">
>     <html:file property="file"/>
>...
></html:form>
>
>I've also tried the <html:file> tag using the accepts attribute,
>accepts="java.io.File", and
>accepts="java.io.String",
>with, of course, the corresponding property in the actionForm set to the
>correct type.
>
>Every time the form is submitted, I get a Servlet Exception:
>BeanUtils.populate and ArgumentTypeMismatchException.
>Am I missing something here?  Should the type of the upload actionForm
>property be File? String?  something else?

something else: org.apache.struts.upload.FormFile

Struts uses a user-configurable implementation of type 
org.apache.struts.upload.MultipartRequestHandler as a factory which 
produces an implementation of FormFile from the HttpServletRequest. 
You rarely have to worry about this detail, but you can set an 
alternative MultipartRequestHandler in the <controller> section of 
your struts-config.xml file.

All you really care about is that when you get the ActionForm in your 
Action, it has a property of type FormFile.

Hope that helps.

Joe

-- 
--
* Joe Germuska    { joe@germuska.com }
"It's pitiful, sometimes, if they've got it bad. Their eyes get 
glazed, they go white, their hands tremble.... As I watch them I 
often feel that a dope peddler is a gentleman compared with the man 
who sells records."
	--Sam Goody, 1956

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message