struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Steinke <Jan-Stei...@gmx.de>
Subject Redirect after File Upload
Date Sat, 11 Aug 2007 11:58:49 GMT
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




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message