Thanks Dave for prompt reply.
Yes, I have defined inputStream property in action class like below.

*private InputStream inputStream;

public InputStream getInputStream() {
        return inputStream;
    }

    public void setInputStream(InputStream inputStream) {
        this.inputStream = inputStream;
    }
*

One more thing that I missed in earlier message, I am getting exception even
before my action method "upload" getting invoked. I have few System.Out in
method, I don't see them in log..it seems to me request is failing before
upload method call...

 public String upload() {

        try{
            UserTO userTo = this.getCurrentUser();

            System.out.println("myPhotoFileName:"+myPhotoFileName);
            System.out.println("myPhoto:"+myPhoto);
            System.out.println("getMyPhotoContentType:"+
this.getMyPhotoContentType());

            if ((myPhotoFileName != null && "".equals(myPhotoFileName)) ||
myPhoto == null) {

                inputStream = new
StringBufferInputStream(this.getText("required.userPhoto"));

                return Action.SUCCESS;
            } else if (myPhoto.length() > 200000) {

                inputStream = new
StringBufferInputStream(this.getText("userPhoto.maxLengthExceeded"));
                return Action.SUCCESS;
            }
            if (!getMyPhotoContentType().startsWith("image/")) {
                inputStream = new
StringBufferInputStream(this.getText("userPhoto.invalidPhotoType"));

                return Action.SUCCESS;
            }

           // Some File Upload logic...

            inputStream = new StringBufferInputStream(myPhotoFileName + "
added to your profile.");
        }catch(Exception exp){
            LOG.error("Exception in Photo Upload:", exp);
            inputStream = new StringBufferInputStream("Photo upload failed.
Please try again later.");
        }
        return Action.SUCCESS;
    }


On Fri, Dec 5, 2008 at 12:45 PM, Dave Newton <[EMAIL PROTECTED]> wrote:

> --- On Fri, 12/5/08, Raghu wrote:
> > I am trying to implement Ajax File Upload using
> > JQuery's Form Plugin which uses iframe internally.
>  JQuery's Form Plugin doc says it support response
> > type of HTML or XML.
> >
> > Without Ajax, my file upload works fine. I am not sure what
> > result type to choose for ajax response.
> >
> > If I use type="stream" then I am getting below
> > exception... Any idea how to resolve this issue...
> > [...]
> > > [WRITE4SMILE] ERROR [2008/12/05 09:53:59] |
> > Servlet.service() for servlet default threw exception
> > java.lang.IllegalArgumentException: Can not find a
> > java.io.InputStream with the name [inputStream] in
> > the invocation stack. Check the <param name="inputName">
> > tag specified for this action.
>
> Surprisingly, the steps for solving this particular issue are described
> completely in the exception message: if you're going to use a stream result
> you need to supply and input stream in your action, the property name of
> said stream being supplied by the "inputName" param.
>
> The contents of that stream would be decided by whatever jQuery's form
> plugin wants--which I don't know. It sounds like you'd need to craft a
> response containing whatever information the form plugin wants; if you can
> qualify those requirements it'll be easier to help.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to