struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mead Lai" <laiqi...@gmail.com>
Subject Re: Struts2 upload
Date Sun, 02 Nov 2008 01:57:25 GMT
<package name="uploads" extends="json-default"

Why not ' extends="struts-default" '?
the form, you need set the "method=post",<s:form method='post'>

On Sun, Nov 2, 2008 at 6:02 AM, Wes Wannemacher <wesw@wantii.com> wrote:

> what is in the fileUpload interceptor stack? Since the setter is never
> called, I would wonder if it is a complete stack.
>
> When you use <interceptor-ref> in an action definition, you are
> overwriting the existing stack with the stack you specify.
>
> -Wes
>
>
> On Sat, 2008-11-01 at 14:54 -0700, Nick J wrote:
> > Hi, I am having some trouble with Uploads in Struts 2.
> > Here is the action:
> > <package name="uploads" extends="json-default" namespace="/_uploads">
> > <!-- ...other actions ...-->
> >               <action name="imageUpload" class="uploadManager"
> method="imageUpload">
> >                       <interceptor-ref name="fileUpload"/>
> >                       <result>/upload.html</result>
> >               </action>
> > </package>
> >
> > Here is the HTML form:
> > <form name="myForm" action="/_uploads/imageUpload"
> > enctype="multipart/form-data">
> >      <input type="file" name="imageUpload" value="Browse ..." />
> >      <input type="submit" />
> > </form>
> >
> > Here's the appropriate part of the action class:
> >
> >       public String imageUpload() {
> >               return ActionSupport.SUCCESS;
> >       }
> >
> >       public List<Image> getImageList() {
> >               return images;
> >       }
> >
> >       public void setImageUpload(File myImage) {
> >               uploadedImage = myImage;
> >       }
> >
> >       public void setImageUploadContentType(String contentType) {
> >               imageContentType = contentType;
> >       }
> >
> >       public void setImageUploadFileName(String filename) {
> >               imageFilename = filename;
> >       }
> >
> > I have debugger break-points in the  imageUpload method, and in the
> setter
> > methods.
> > The execution never reaches the setters, and when it breaks in the
> > imageUpload method,
> > and I inspect the values of uploadedImage, imageContentType and
> > imageFilename they are all null, so the interceptor has not called the
> the
> > setters like I was expecting it to. As far as I can tell, this agrees
> with
> > all the tutorials I've read, so I'm at a loss now. If anyone has any
> ideas,
> > I'd be very greatful!
> >
> > thanks!
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
BestRegards,
Mead
http://yayisoft.com

Bernard Baruch  - "Vote for the man who promises least; he'll be the least
disappointing."

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message