Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8383359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:08:41+00:00 2026-06-09T17:08:41+00:00

I would to know why I don’t get anything with this. I have a

  • 0

I would to know why I don’t get anything with this. I have a function who return a byte array from SQL Server 2008 but I don’t get anything, why? .getWhiteLabelingLogo() is a function which returns a byte[] with the image which I want to show at the jsp page. I access to this

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.rmi.RemoteException;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.apache.axis.MessageContext;
import org.apache.struts2.ServletActionContext;
import org.datacontract.schemas._2004._07.CCIS_Web_Services_PublicApi.PapiAccountInfo;
import org.datacontract.schemas._2004._07.CCIS_Web_Services_PublicApi.PapiUserInfo;

import Services.Web.CCIS.BasicHttpBinding_PublicApiServiceStub;
import Services.Web.CCIS.PublicApiService_PortType;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class ShowImageAction extends ActionSupport{
  Map session;
 private byte[] itemImage; 
 private InputStream str = null;
public String execute() throws RemoteException { 
    System.out.println("Estoy aquí");
        HttpServletResponse response = ServletActionContext.getResponse(); 


   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();
            str=new ByteArrayInputStream(itemImage);
        return SUCCESS;




}

  public void setItemImage(byte[] itemImage) { 
      this.itemImage = itemImage; 
   }

   public InputStream getStr() {
    return str;
   }

   public void setStr(InputStream str) {
    this.str = str;
   }

   public byte[] getItemImage() {
    return itemImage;
   } 


  }

at index.jsp I have this:

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

And in struts.xml I have this:

 <action name="ShowImageAction">
  <result name="success" type="stream">
    <param name="inputName">str</param>
    <param name="contentType">image/jpeg</param>

 </result>
</action>

What I’m doing bad because I haven’t anything. Thanks so much

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:08:42+00:00Added an answer on June 9, 2026 at 5:08 pm

    Well, for starters, you don’t have an action method at all. You do have a method named execute, but it is static and returns void. Action methods are non-static and return a String, which maps to a result in the struts.xml.

    Additionally, after you set the content type on the response, you never send any data.

    There are other problems with this action as well, such as the use of mutable static fields on the action, which is not thread-safe.

    Here are some steps to take:

    • Change the execute method to be non-static and return a String
    • Add a return SUCCESS; line at the end of the method
    • Update the struts.xml mapping to refer to the result “success” (SUCCESS is a constant for which the actual value is “success”)
    • Make the three member fields non-static
    • Set the content type in the struts.xml, rather than in the code (see example below)
    • Remove the response.reset() and .setContentType() calls

    Example:

    <action name="ShowImageAction" class="package.for.ShowImageAction">
      <result name="success" type="stream">
        <param name="contentType">image/jpeg</param>
        <param name="inputName">str</param>
      </result>
    </action>
    

    Then, if it is still not working for you, revise your question appropriately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code and don't know if what I would like to achieve
I don't know if this would be coined as wrong place to ask this
I don't know the name for this, if did i would search for it.
I don't know why I'm experiencing so much trouble with this, but I would
I would like to create a multi-dimensional array with two variables but don't know
I don't know if any of you have seen this before: I have an
i don't know if this can be done using php but it would be
I would like to know who can I retrieve the date from a file.
I don't know if a solution exists but it would be highly desirable. I'm
i don't know what you call it, but how would i change fields /

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.