You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bill blackmon <bi...@verizon.net> on 2003/05/25 23:42:16 UTC
Email Attachement/Fileupload question
I'm trying to create a file attachement for an email app. I can't get the
file captured from the jsp page
to be recoginzed when the form is submitted. I have the following
definitions:
/* JSP FORM ENTRY */
<html:form enctype="multipart/form-data" action="/attachFile" method="post">
<input type="file" name="file">
<input type="submit" value="Upload File">
</html:form>
/* ACTION DECLARATION */
action
path="/attachFile"
type="com.recovery.actions.AttachEmailAction"
name="emailFormEx"
scope="request"
input="/adminEmailBody.jsp"
validate="false">
<forward name="Success" path="/adminEmailBody.jsp" />
</action>
/* FORM CLASS */
Form class has following declarations for file field:
File file = null;
public void setFile(File file) { this.file = file; }
public File getFile() { return this.file; }
/* ERROR MESSAGE */
javax.servlet.ServletException: BeanUtils.populate
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1098)
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
ava:1574)
at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
ava:1468)
at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:14
98)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:613)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1096)
/////////////////////////////
Is there an example of something like this anyplace? I can't see to find
one.
Thanks,
Bill
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org