You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rich Rodriguez <ri...@missiondata.com> on 2002/04/02 20:14:16 UTC

File Upload and Mozilla 0.99

I'm having problems with uploading files with mozilla 0.99 and struts. 
 Rather, the problem is when the file is optional and the user chooses 
*not* to upload one.  A partial stack trace below:

Root cause:
java.lang.IllegalArgumentException: argument type mismatch
        at java.lang.reflect.Method.invoke(Native Method)
        at 
org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.
java:988)
        at 
org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.
java:904)
        at 
org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:9
32)
        at org.apache.struts.util.BeanUtils.populate(BeanUtils.java:509)
        at 
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:772)
        at 
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.
java:2061)
        at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:156
3)
        at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)

There are other input fields in the form, and I am using the struts html 
tags for all fields including the file.  The form enctype is set 
correctly, and the code works flawlessly with IE as the browser.

I have found this bug against mozilla:
http://bugzilla.mozilla.org/show_bug.cgi?id=132069

To summarize, they are not sending the filename in the 
multipart/form-data is no file is present.  Is struts assuming the 
filename to always be there?

Rich


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


problem with arraylist and iterate

Posted by Jefferson Rodrigues de Oliveira e Silva <je...@edb.ericsson.se>.
Hi all,

I have the following problem:

I have a bean User which has a hashtable attribute bets. The
getBets method returns a Bet[]  array.

The Bet class has 6 attributes.

In the bets.jsp page, I show in a table all the values from the Bet objects
(using iterate), one row for each object, and two of these values from each
object
the user is able to edit.

The bets.jsp page is ok, all the values are being displayed, and
the user can edit the two fields for each row.

My problem is when the user submit this bets.jsp.

How can I get all the fields (two for each table row) in a
Form bean ?

I want that the FormBean to handle the submit is the BetsForm ?
I implemented the BetsForm with a single attribute, an ArrayList
called bets.

How should I implement this BetsForm bean ? How can it
receive all the fields from the bets.jsp page in the
arraylist attribute ?


Thanks in advance
Jefferson

Re: File Upload and Mozilla 0.99

Posted by Kubo Hiroshi <hi...@netird.ad.jp>.
Hi.

> I'm having problems with uploading files with mozilla 0.99 and struts. 
> Rather, the problem is when the file is optional and the user chooses 
> *not* to upload one.  A partial stack trace below:

I encountered the same problem.

Thanks to Rich's information, I managed to avoid the run-time error
with a dirty trick.

Try the following setter and getter for file type property in the 
ActionForm sub-class:


	   FormFile theFile;

	   Object getTheFile() {
		  return theFile;
           }
           setTheFile(Object theFile) {
                  if (theFile instanceof FormFile) {
                       this.theFile = (FormFile) theFile;
                  }
           }


Bye.

---
hiroshi@netird.ad.jp

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>