0

こんにちは、私はここで見た例に従いますが、悪い結果が得られました。これは次のShowImageActionとおりです。

public static void execute() throws RemoteException {  

HttpServletResponse response = ServletActionContext.getResponse();  
response.reset();  
response.setContentType("multipart/form-data");   
session = ActionContext.getContext().getSession(); 
PublicApiService_PortType puerto=(PublicApiService_PortType) session.get("puerto"); 
((BasicHttpBinding_PublicApiServiceStub)puerto).setMaintainSession(true); 

MessageContext ctx=(MessageContext) session.get("contexto"); 
PapiUserInfo[] users; 

users = puerto.getUsers(); 
Long accountID=users[0].getID(); 
PapiAccountInfo info=puerto.getAccountInfo(accountID); 
itemImage=info.getWhiteLabelingLogo(); 
System.out.println(itemImage); 
OutputStream out; 

try { 
    out = response.getOutputStream(); 
    out.write(itemImage);  
       out.flush();  
       out.close(); 
} catch (IOException e) { 
    // TODO Auto-generated catch block 
    e.printStackTrace(); 
} 




} 

どこでgetWhiteLabelingLogo(); 私にブロブを返しbyte[]、それから私のjspで私はこれを持っています:

<img src="<s:url value="ShowImageAction" />" border="0" width="100" height="100">  

なぜそれが機能しないのですか?. それは正しいですか?本当にありがとう

4

1 に答える 1

0

Dave が言及したストリーム結果タイプのために実装する必要があるものの基本:

strusts.xml:

<action name="yourImageStreamAction">
    <result name="success" type="stream">
        <param name="inputName">inputStream</param>
    </result>
</action>

アクション:

private InputStream inputStream = null;

public String execute() {
   //set inputStream from itemImage.  
   //I don't know what itemImage is, so I'll leave that to you
   return SUCCESS;
}

public InputStream getInputStream() {
   return this.inputStream;
}
于 2012-07-29T23:17:42.290 に答える