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/16 16:28:57 UTC

Struts2 ajax and StreamResult

Hi,
i've got a StreamResult from a Struts action ( using struts 2.0.9), that 
returns an image/jpeg.
Works fine without using ajax(shows the image into the broser, but in a 
new window),
but returns only plain text with using ajax.

My Code:

xml:

        <action name="showPhoto" class="actions.GetPhotoAction">
           <result name="success" type="stream">
               <param name="contentType">image/jpg</param>
               <param name="inputName">imageStream</param>
               <param name="contentDisposition">filename="image.jpg"</param>
               <param name="bufferSize">1024</param>
           </result>
        </action>


jsp:

without ajax:
<s:form action="showPhoto.action">
    ...
    <s:submit value="show Image"/>
</s:form>

and with ajax:

<s:form action="showPhoto.action">
    ...
    <s:submit theme="ajax" targets="image" executeScripts="true" 
showLoadingText="false" value="show Image"/>
</s:form>

<img id="image">


Thanks a lot for any help,

Jan Steinke

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