Hi,
As per my knowledge Your Libraries are Ok...any way ,
Have you set the
<html:form action="/youraction" method="post"
enctype="multipart/form-data">
??
Regards,
Mano
-----Original Message-----
From: Chris Searle [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 28, 2006 2:15 PM
To: [email protected]
Subject: File upload using DynaActionForm/SynaValidatorForm
Struts 1.2
I need to try to get file upload to work for an existing struts app.
I was reading through the following:
http://wiki.apache.org/struts/StrutsFileUpload
where it mentions the following for Dyna action forms:
<form-bean name="myForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="myFile"
type="org.apache.struts.upload.FormFile"/>
</form-bean>
So - based on this - I ended up with the following for a DynaValidatorForm:
<form-bean name="uploadFile"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="title" type="java.lang.String"/>
<form-property name="revdate" type="java.lang.String"/>
<form-property name="revinfo" type="java.lang.String"/>
<form-property name="documentfile"
type="org.apache.struts.upload.FormFile"/>
</form-bean>
However - when the form POSTs to this action - I get the following in
the log:
2006-11-28 09:35:52,986 ERROR [org.apache.struts.util.RequestUtils]
Error creating form bean of class
org.apache.struts.validator.DynaValidatorForm
java.lang.NullPointerException: The type for property documentfile is
invalid
at
org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:415)
at
org.apache.struts.action.DynaActionFormClass.newInstance(DynaActionFormClass
.java:184)
at
org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java
:212)
at
org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:294)
at
org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:193)
at
org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor
.java:321)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:204)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
Does the DynaValidatorForm support FormFile? Is there some jar
dependency I need in place - maybe something from commons? I have the
following at present:
commons-beanutils.jar
commons-collections.jar
commons-dbcp.jar
commons-digester.jar
commons-fileupload.jar
commons-lang.jar
commons-logging.jar
commons-pool.jar
commons-resources.jar
commons-validator.jar
Have I missed some other obvious item? Made some really simple mistake?
For info - the form for submission looks like (formatting removed):
<form method="post" action="/admin/saveFile.do"
enctype="multipart/form-data">
<input type="text" size="30" name="title" id="title" value=""/>
<input type="text" size="30" name="revdate" id="revdate" value=""/>
<input type="text" size="30" name="revinfo" id="revinfo" value=""/>
<input type="file" size="30" name="manual" id="manual" value=""/>
<input type="submit" size="30" name="submit" id="submit" value="Save"/>
</form>
(note - this is generated using the velocity-tools for struts rather
than the standard jsp libraries).
--
Chris Searle
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]