You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

With the html as follows:

   <img src="myWebAppContext/myAction!default.action />

xwork.xml could be as follows:

<xwork>
    ...

    <action name="myAction" class="...">
        <result name="myImageResult" type="stream">
            <param name="contentType">${myContentType}</param>
            <param name="contentDisposition">${myContentDisposition}</param>
            <param name="contentLength">${myContentLength}</param>
            <param name="bufferSize">${myBufferSize}</param>
        <result>
    </action>

    ...
</xwork>

the action could be as follows:

public class MyAction extends ActionSupport {
   public String doDefault() {
        return "myImageResult";
    }
   public byte[] getMyImageInBytes() { .... }

   public String getMyContentType() { ... }
   public String getMyContentDisposition() { ... }
   public int getMyContentLength() { .... }
   public int getMyBufferSize() { ... }
}

  • No labels