Jan Steinke wrote:
Hi There,
I would like to upload some jpegs with struts 2.0.9 and redirect to another site after the Action returns SUCCESS. I tried is like this ( after reading the file upload example from the struts 2 showcases):

uploadPictureForm.jsp:

<s:form action="uploadPicture.action" method="POST" enctype="multipart/form-data"> Datei hochladen (1): <s:file name="upload" accept="image/*"/><br> Datei hochladen (2): <s:file name="upload" accept="image/*"/><br> Datei hochladen (3): <s:file name="upload" accept="image/*"/><br> Datei hochladen (4): <s:file name="upload" accept="image/*"/><br> Datei hochladen (5): <s:file name="upload" accept="image/*"/><br> <s:a theme="ajax" targets="center" executeScripts="true" showLoadingText="true">upload</s:a>
              </s:form>

actions.xml (package inside struts.xml):

<action name="uploadPicture" class="actions.UploadPictureAction" method="upload">
           <result name="input">uploadPictureForm.jsp</result>
           <result>viewPictures.jsp</result>
      </action>

UploadPictureAction.java:

....
  private File[] upload;
       public String upload() throws Exception {
      if(upload != null) {
          ... // do something with my files
          }
        ....           System.out.println("reached End of Action");
               return SUCCESS;
  } ....

Works fine except there's no redirect after return SUCCESS (I also tried different combinations in actions.xml like
<result name="success" type="redirect">....
But I get the same result. Successfull upload and no redirect :-( .

Thanks for every reply,

Jan

You'll need type="redirect" on your success result in order to get a redirect. If that's not working, you probably aren't specifying the redirect target correctly. Is 'viewPictures.jsp' a valid URL *relative to* the URL your form posts to? Have you tried, for example, /viewPictures.jsp or /YourContext/viewPictures.jsp?

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to