You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Purcell <sp...@vertisinc.com> on 2005/10/17 18:46:51 UTC
Upload To URL of another Server
Hello,
I have the need to upload a multipart file to another server so therefore another url. The other server is not of the struts platform.
The form in which I am uploading from has three (form fields) plus the upload file part. I do need to validate that the form fields have proper data and that the file is there before the user can submit and leave this page. When they submit, I need the submission to go to another server where a servlet will write the file, and then redirect back to somewhere for the user.
I am currently using html:action from my form, but wasn't sure how to handle this, since I am doing this in the JSP page:
<html:form action="UploadSubmit">
but really it needs to do something like
<html:form action="http://someurl/servlet/dumpfile">
In my original UploadSubmit form there is a bean:
<action
path="/DisplayCatalogUploadForm"
type="com.xxx.xxx.UploadNewCatalogAction"
validate="false"
scope="request"
name="CatalogUploadBean">
<forward name="Success" path="/jsp/my.jsp" />
</action>
If anyone has done something like this, or has a idea of how to attempt it, please let me know.
Thanks,
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Upload To URL of another Server
Posted by Laurie Harper <la...@holoweb.net>.
Scott Purcell wrote:
> Hello,
>
> I have the need to upload a multipart file to another server so therefore another url. The other server is not of the struts platform.
>
> The form in which I am uploading from has three (form fields) plus the upload file part. I do need to validate that the form fields have proper data and that the file is there before the user can submit and leave this page. When they submit, I need the submission to go to another server where a servlet will write the file, and then redirect back to somewhere for the user.
>
> I am currently using html:action from my form, but wasn't sure how to handle this, since I am doing this in the JSP page:
> <html:form action="UploadSubmit">
>
> but really it needs to do something like
> <html:form action="http://someurl/servlet/dumpfile">
>
> In my original UploadSubmit form there is a bean:
>
> <action
> path="/DisplayCatalogUploadForm"
> type="com.xxx.xxx.UploadNewCatalogAction"
> validate="false"
> scope="request"
> name="CatalogUploadBean">
> <forward name="Success" path="/jsp/my.jsp" />
> </action>
>
>
> If anyone has done something like this, or has a idea of how to attempt it, please let me know.
>
> Thanks,
> Scott
You can have the form submit to another server, but if you need to
validate the form fields you'll either need to implement that validation
on the other server, or submit your form to the application as normal
for validation and then have the application forward the file on to the
other server.
To get the form to submit directly to another server, you'll need to
change your <html:form/> tag to a regular <form/> tag (i.e. don't use
the JSP tag). The trouble with that is that you can't use the other
<html:*/> tags to render the form, since they need to be called from
within a <html:form/> tag.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org