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/13 22:56:25 UTC

ajax File Upload

Hi There,
i've implemented an Ajax FileUpload using struts 2.0.9. Works fine and 
(since my last mail to this list) redirects to a result jsp.
But the Browser only shows [object HTMLDocument] inside the "targets" 
div instead of the result page.

My Code.
....
                <s:form action="uploadPicture.action" method="POST" 
enctype="multipart/form-data">
                    File(1): <s:file name="upload" accept="image/*"/><br>
                    File (2): <s:file name="upload" accept="image/*"/><br>
                    File (3): <s:file name="upload" accept="image/*"/><br>
                    <s:a  theme="ajax" targets="aTargetDiv" 
executeScripts="false" >upload</s:a>
                </s:form>
....
                <s:div id="aTargetDiv">

                </s:div>
.....
xml config:
        <action name="uploadPicture" class="actions.UploadPictureAction" 
method="upload">
                        <result name="input">uploadPictureForm.jsp</result>
                        <result>viewUploadResult.jsp</result>
        </action> 


result page:
...
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>View Result</title>
    </head>
    <body>
       
        <br>
        upload  finished
        <br>
    </body>
</html>

Thanks a lot for any help,

Jan

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


Re: ajax File Upload

Posted by Umesh kudtarkar <uk...@strongmail.com>.
The result is returned to another iframe. You need to do something like this
to get it working.

http://www.mail-archive.com/user@struts.apache.org/msg60245.html



Jan Steinke wrote:
> 
> Hi There,
> i've implemented an Ajax FileUpload using struts 2.0.9. Works fine and 
> (since my last mail to this list) redirects to a result jsp.
> But the Browser only shows [object HTMLDocument] inside the "targets" 
> div instead of the result page.
> 
> My Code.
> ....
>                 <s:form action="uploadPicture.action" method="POST" 
> enctype="multipart/form-data">
>                     File(1): <s:file name="upload" accept="image/*"/><br>
>                     File (2): <s:file name="upload" accept="image/*"/><br>
>                     File (3): <s:file name="upload" accept="image/*"/><br>
>                     <s:a  theme="ajax" targets="aTargetDiv" 
> executeScripts="false" >upload</s:a>
>                 </s:form>
> ....
>                 <s:div id="aTargetDiv">
> 
>                 </s:div>
> .....
> xml config:
>         <action name="uploadPicture" class="actions.UploadPictureAction" 
> method="upload">
>                         <result
> name="input">uploadPictureForm.jsp</result>
>                         <result>viewUploadResult.jsp</result>
>         </action> 
> 
> 
> result page:
> ...
> <html>
>     <head>
>         <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8">
>         <title>View Result</title>
>     </head>
>     <body>
>        
>         <br>
>         upload  finished
>         <br>
>     </body>
> </html>
> 
> Thanks a lot for any help,
> 
> Jan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ajax-File-Upload-tf4263655.html#a12134235
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: ajax File Upload

Posted by Jan Steinke <Ja...@gmx.de>.
FF and IE. Doesn't make a difference using a jsp or a jspf as result. 
I'm getting still a
[object HTMLDocument] in my div.

Jan

Musachy Barroso schrieb:
> That's a little bit strange, does it happen on FF and IE? Does it
> happen even if you return just an HTML fragment? (instead of the whole
> page)
>
> musachy
>
> On 8/13/07, Jan Steinke <Ja...@gmx.de> wrote:
>   
>> Hi There,
>> i've implemented an Ajax FileUpload using struts 2.0.9. Works fine and
>> (since my last mail to this list) redirects to a result jsp.
>> But the Browser only shows [object HTMLDocument] inside the "targets"
>> div instead of the result page.
>>
>> My Code.
>> ....
>>                 <s:form action="uploadPicture.action" method="POST"
>> enctype="multipart/form-data">
>>                     File(1): <s:file name="upload" accept="image/*"/><br>
>>                     File (2): <s:file name="upload" accept="image/*"/><br>
>>                     File (3): <s:file name="upload" accept="image/*"/><br>
>>                     <s:a  theme="ajax" targets="aTargetDiv"
>> executeScripts="false" >upload</s:a>
>>                 </s:form>
>> ....
>>                 <s:div id="aTargetDiv">
>>
>>                 </s:div>
>> .....
>> xml config:
>>         <action name="uploadPicture" class="actions.UploadPictureAction"
>> method="upload">
>>                         <result name="input">uploadPictureForm.jsp</result>
>>                         <result>viewUploadResult.jsp</result>
>>         </action>
>>
>>
>> result page:
>> ...
>> <html>
>>     <head>
>>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>>         <title>View Result</title>
>>     </head>
>>     <body>
>>
>>         <br>
>>         upload  finished
>>         <br>
>>     </body>
>> </html>
>>
>> Thanks a lot for any help,
>>
>> Jan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
>
>   


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


Re: ajax File Upload

Posted by Musachy Barroso <mu...@gmail.com>.
That's a little bit strange, does it happen on FF and IE? Does it
happen even if you return just an HTML fragment? (instead of the whole
page)

musachy

On 8/13/07, Jan Steinke <Ja...@gmx.de> wrote:
> Hi There,
> i've implemented an Ajax FileUpload using struts 2.0.9. Works fine and
> (since my last mail to this list) redirects to a result jsp.
> But the Browser only shows [object HTMLDocument] inside the "targets"
> div instead of the result page.
>
> My Code.
> ....
>                 <s:form action="uploadPicture.action" method="POST"
> enctype="multipart/form-data">
>                     File(1): <s:file name="upload" accept="image/*"/><br>
>                     File (2): <s:file name="upload" accept="image/*"/><br>
>                     File (3): <s:file name="upload" accept="image/*"/><br>
>                     <s:a  theme="ajax" targets="aTargetDiv"
> executeScripts="false" >upload</s:a>
>                 </s:form>
> ....
>                 <s:div id="aTargetDiv">
>
>                 </s:div>
> .....
> xml config:
>         <action name="uploadPicture" class="actions.UploadPictureAction"
> method="upload">
>                         <result name="input">uploadPictureForm.jsp</result>
>                         <result>viewUploadResult.jsp</result>
>         </action>
>
>
> result page:
> ...
> <html>
>     <head>
>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>         <title>View Result</title>
>     </head>
>     <body>
>
>         <br>
>         upload  finished
>         <br>
>     </body>
> </html>
>
> Thanks a lot for any help,
>
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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