You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jan Steinke <Ja...@gmx.de> on 2007/08/11 13:58:49 UTC
Redirect after File Upload
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