Is

<html:file property="photo"/>

within any iterate/loop ?


-----Original Message-----
From: Ben Janes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 1:22 PM
To: [EMAIL PROTECTED]
Subject: Problem with FormFile



Hi

I have a problem with FormFile, in that when it has no file entered it
throws an error:

I belive this is the cause of the error:
15 Dec 2003 13:21:10 - DEBUG [Thread-2] (BeanUtils.java:873) -
setProperty([EMAIL PROTECTED],
photo, [])
15 Dec 2003 13:21:10 - DEBUG [Thread-2] (ConvertUtils.java:369) - Convert
string '' to class
'org.apache.struts.upload.FormFile'
15 Dec 2003 13:21:10 - DEBUG [Thread-2] (ConvertUtils.java:377) -   Using
converter
[EMAIL PROTECTED]

This is the web output:
javax.servlet.ServletException: BeanUtils.populate
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
...
root cause

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:1789)
at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
ava:1684)
at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17
13)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
...

The ACtionForm

package...

import...

public class ChangeContactForm extends org.apache.struts.action.ActionForm {
    private FormFile photo=null;

    public FormFile getPhoto() {
        return this.photo;
    }

    public void setPhoto(Object photo) {
        System.out.println("(String)photo.class:"+photo.getClass());
        this.photo=null;
    }

    public void setPhoto(FormFile photo) {
        System.out.println("(FormFile)photo.class:"+photo.getClass());
        this.photo=photo;
    }

}

There is more code, I have just removed for sending purposes, the setPhoto
with the object parater
was to try and work round the error, though I actually believe the error is
in ConvertUtils.....
Any ideas?

Mvh
Benjamin A. Janes
------------------------------------
BLUEWAVE SVERIGE

M. +46 (0)40-631 1068
F. +46 (0)40 -631 10 50
F. +46 (0)46-540 03 50
Drottninggatan 18,
S-211 49 Malmö,
Sweden



---------------------------------------------------------------------
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]

Reply via email to