RE: Problem with FormFile

2003-12-16 Thread Ben Janes

Does anyone have any ideas, or is it a bug?

;vh

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


   
   

  "Ben Janes"  
   

  <[EMAIL PROTECTED]To:   "Struts Users Mailing List" 
<[EMAIL PROTECTED]>
 
  com> cc: 
   

           Subject:  RE: Problem with FormFile 
   

  2003-12-16 12:31 
   

  Please respond to
   

  "Struts Users
   

  Mailing List"
   

   
   

   
   






No iterate loop

<%@ pagelanguage="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib  uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/meganexus.tld" prefix="mg" %>
<[EMAIL PROTECTED] file="sessionManager.jsp" %>
<%
Integer curUserID=mSes.getUserId(session.getId());
// Get Node for User
com.meganexus.networking.map.GraphNodeContainer
gnc=com.meganexus.networking.map.GraphBuilder.getNode(curUserID.intValue());
if (gnc.isGraphBeingRebuilt()) {
mSes.addMessage(session.getId(),"messages.graphbeingrebuilt");
}
com.meganexus.networking.info.Person curUser=gnc.getNode().getPerson();

%>

http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>

<[EMAIL PROTECTED

RE: Problem with FormFile

2003-12-16 Thread Ben Janes

  <[EMAIL PROTECTED]To:   "'Struts Users Mailing 
List'" <[EMAIL PROTECTED]> 
  
  t.com>       cc: 
   

   Subject:  RE: Problem with FormFile 
   

  2003-12-16 09:27 
   

  Please respond to
   

  "Struts Users
   

  Mailing List"
   

   
   

   
   





Is



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ö,
S

RE: Problem with FormFile

2003-12-16 Thread Aswathy R
Is



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]



Re: problem with FormFile

2001-08-01 Thread Martin Cooper

To use file upload, you need to specify the method and encoding for the
form, like this:

  
...
  

--
Martin Cooper


- Original Message -
From: "Bar³omiej Paw³owski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 01, 2001 7:24 AM
Subject: problem with FormFile


> Hi,
> I have created file upload.jsp:
> <%@ page contentType="text/html; charset=ISO-8859-2" %>
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>
> 
> 
> 
>
> 
> upload
> 
> 
>   
>File 
>Upload
>   
> 
> 
> and ActionForm bean:
> public class UploadForm extends ActionForm {
>
> private FormFile file;
> public UploadForm() {
> }
>
> public void setFile(FormFile file) {
> this.file = file;
> }
> public FormFile getFile() {
> return file;
> }
> }
>
> when I submit this form I receive following exception:
>
> Internal Servlet Error:
>
> javax.servlet.ServletException: BeanUtils.populate
>  at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:486)
>  at
>
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:19
10)
>
>  at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521)
>
> 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:82
5)
>
>  at
>
org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:75
6)
>
>  at
> org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:782)
>
> What is wrong?
> Who can help me?
>
>