On 9/1/05, Pierre-Alain Branger <[EMAIL PROTECTED]> wrote:
> Fist time I used this mailing list, I ve seen that I ve made a mistake
> sending this mail to the developpers list.
> 
>  "It's just for generating the html that the browsers render."
> It doesn't seem in my case:

no, really, i mean it.  same goes for the Struts jsp tags.  neither
they nor Velocity nor VelocityTools directly interact with the
browser.  they just used to create html markup.  that html is then
sent to the browser via the servlet response created by the servlet
container.  the browsers do their thing with that and send a request
back.  if you are posting a form with a fileupload, then that should
go to a Struts Action for processing.  it appears to be during this
last step that you are getting errors.  so, again, the only part
Velocity plays is generating the html markup at the start.

if you are getting an error when trying to do this with
VelocityStruts, but you don't get one when using the Struts tags, i
*guarantee* you that that means your Velocity template is generating
different markup than your jsp with Struts tags.  IMHO, the first step
to figuring out why one works and the other doesn't is to look at the
HTML that each generate.  then we can figure out where and why they
are different.

so, the Velocity template snippet is a start.  but since i've never
used fileupload stuff, i have no idea what the problem with it is. 
i'd have a better idea if i could compare the html output of that
section of the template against a comparable html markup generated by
Struts tags.

> Using a FileUploadAction which just forward to my display page:
> 
> The following FileUploadForm works well with Konqueror and Safari but
> doesn't with FireFox Mozilla and Explorer
> 
> public class FileUploadForm extends ActionForm {
>     protected FormFile file;
>     protected String type;
> 
>     public String getType() { return type; }
>     public void setType(String s){ type =3D s; }
> 
>     public FormFile getFile() { return file; }
>     public void setFile(FormFile file) { this.file =3D file; }
>  }
> 
> This one  works well with FireFox Mozilla and Explorer but doesn't
> with Konqueror and Safari
> 
> public class FileUploadForm extends ActionForm {
>     protected FormFile file;
>     protected String type;
> 
>     public String getType() { return type; }
>     public void setType(String s){ type =3D s; }
> 
>     public FormFile getFile() { return file; }
>     public void setFile(FormFile file) { this.file =3D file; }
>  }
> 
> In both case my Html Form is :
> <form action="$link.setAction("fileUpload")" enctype="multipart/form-data">
> <p>$text.get("blast.upload")<br>
> <input type="hidden" value="$interfaceJob.type" name="type">
> <input type="file" name="file"> <input type="submit"
> value="$text.get("button.ok")"></p>
> </form>
> 
> I ll post this mail to the user list!
> 
> Pierre
> 
> 
> On 9/1/05, Nathan Bubna <[EMAIL PROTECTED]> wrote:
> > Hi Pierre,
> >
> > I don't see where Velocity makes the difference here.  It's just for
> > generating the html that the browsers render.  Are you using the
> > VelocityStruts tools?  If so, can you show us a snippet of the
> > relevant template?  Also, it might also be good to attach the same
> > relevant snippets of the html that you get as output from that
> > template and from a parallel jsp.  The difference between the two
> > might be quite instructive.  I'm also curious how the html output
> > changes when you change the FormFile variable into a String variable.
> >
> > I've never had cause to use or look into Struts' FileUpload support
> > before, so i don't know much.  But perhaps i can be an extra set of
> > eyes to spot differences in the html output.  Or maybe someone else on
> > the list will be able to help.
> >
> > Oh, and this is a question that belongs on the [EMAIL PROTECTED]
> > or [EMAIL PROTECTED] mailing lists.  Unless we identify a bug in the
> > VelocityStruts tools, this has much more to do with the *using* of
> > Velocity and Struts than it does with the development of Velocity. :)
> >
> > -nathan
> >
> > On 9/1/05, Pierre-Alain Branger <[EMAIL PROTECTED]> wrote:
> > > Hi All,
> > >
> > > I can easily do an upload, using jsp and the struts uploadAction, but
> > > using velocity I obtain the folowing errors in the firefox and mozilla
> > > browsers:
> > >
> > > javax.servlet.ServletException: BeanUtils.populate
> > > and
> > > java.lang.IllegalArgumentException: argument type mismatch
> > >
> > > However, I don't have any error using Konqueror or Safari.
> > >
> > > Here is my FileUploadForm.java
> > >
> > > import javax.servlet.http.HttpServletRequest;
> > > import org.apache.struts.action.*;
> > > import org.apache.struts.upload.FormFile;
> > > import org.apache.struts.upload.MultipartRequestHandler;
> > >
> > > public class FileUploadForm extends ActionForm {
> > >     protected FormFile file;
> > >     protected String type;
> > >
> > >     public String getType() { return type; }
> > >     public void setType(String s){ type =3D s; }
> > >
> > >     public FormFile getFile() { return file; }
> > >     public void setFile(FormFile file) { this.file =3D file; }
> > >  }
> > >
> > > If I change the FormFile variable into a String variable, then firefox
> > > and mozilla accept the FormBean but with Konqueror and Safari the same
> > > error happen.
> > >
> > > Does the struts markup <html:file /> function differently than the
> > > standard <input type=3D"file"> or does anyone have an idea how to use a
> > > struts download Action with velocity which work with all browsers.
> > >
> > > Pierre
> > >
> > > ---------------------------------------------------------------------
> > > 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