How to pass a object of JSP to a servlet called from JSP

Hi,
I am trying to display an image in the JSP through html image tag. I am using Struts Action class to get the image data from the database through a Session EJB. I am getting a byte array for the image retrieved from the database.
To display the image I need to call a servlet from the JSP from the image tag like this.
<html:img src="imageservlet" border="0"/>
But I need to send the image byte [] array data which is available with the JSP to the servlet to build image. I have a bean object with the JSP which holds the image byte []. The servlet should receive the bean object and will use the byte [] and build the image to be displayed.
My query here is how to send this bean object to the servlet which is getting called from the JSP as shown above.
Thanks in advance.

Hi,
Thanks for your response. I knew it is possible with session objects. But I want to perform this operation with out using session objects. Is there a way to accomplish this with out using Session objects.
Please help.
Thanks

Similar Messages

  • Servlet call from jsp pages on Hosting server instead of Local system

    HI,
    We have started hoste our projects on one of the Dedicated service from US.
    We have used servlets in our projects and uploaded servlet based project on Dedicated server ,so now we are getting one ERROR ,when we try to access servlet pages from browser .
    sample Below ERROR we are getting on browser ,when we try to access the servlet...
    The requested URL /Globalcontactservlet was not found on this server
    In Web.xml i have written mappings for servlets and i have included web.xml file under the Web-inf folder as same process we do on local system server.(Tomcat 5.5)
    on browser i am trying to use the below format to request the servlet mapping
    <form method="POST" action="http://www.xyz.com/Globalcontactservlet" >
    </form>

    You can download Oracle's latest JDBC drivers from: http://otn.oracle.com/software/content.html
    You need to register, but it should be free.
    When you get the zip/jar-file, you have several options. You can either place it in the common classpath of your system/Servlet container (recommended if you use it in most of your webapps), or in the WEB-INF/lib directory of your webapp (if you only use it with that particular one).
    .P.

  • How to pass an object from jsp to other jsp using SendRedirect

    How to pass an object from one jsp to the other jsp using ssendRedirect with out using the session
    I am having 2 jsps
    x.jsp and y.jsp
    From x.jsp using sendRedirect iam going to y.jsp
    From x.jsp i have pass an object to the y.jsp
    Is it possible without putting the object in session
    Is it possible using EncodeUrl
    Please help me Its Urgent

    Is it possible without putting the object in sessionAnything is possible. Would you accept that it is very difficult?
    When you send a redirect, it tells the browser to send a new request for the target page. That means any request parameters/attributes are lost.
    Is it possible using EncodeUrl response.encodeURL() puts the session id into a url if the browser does not support cookies. It is purely for retaining the session.
    There are two ways that you can communicate across a sendRedirect.
    1 - use the session
    2 - pass a parameter in the url.
    parameters are string based, so passing objects is almost out of the question.
    Potentially you could serialize your object, encode it in base64 (so it is composed completely as characters) and pass it as a parameter to the other page, where you retrieve it, unencode it, and then load the serialized object.
    Or you can just use the session.

  • MVC2.0-- how to pass bean object to jsp

    Hi All,
    Anybody please tell me how to pass bean class object from controller to jsp ?
    I am developing an application in MVC2.0.
    I am creating an object of bean class in controller servlet and want to pass this object to jsp so anybody please tell how to pass this object to jsp.
    ControllerServlet--
    Bean obj = new Bean();
    Bean --
    public String aMethod() {
    return data;
    I have to use this method in my jsp and I am creating an object of this bean in controller servlet.
    Please help
    Thanks
    Please reply soon

    Hi,
    Thanks for your response. I knew it is possible with session objects. But I want to perform this operation with out using session objects. Is there a way to accomplish this with out using Session objects.
    Please help.
    Thanks

  • How to pass in a parameter into a report viewer on a jsp - and hidden

    Hi, I've built a php application and am using the java environment to enable the crystal report/viewer.  The developer was looking how to pass in a parameter into a report viewer on a jsp. Ultimately the end product we need is to get an HTML report viewer loading a report file with hidden parameters so to not expose other customer data (it's a shared database for multiple customers) preferably loaded from php using maybe the php java bridge. Would anyone happen to have any sample code or any guidance?
    <%@ page contentType="text/html; charset=UTF-8"
       pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="/crystal-tags-reportviewer.tld" prefix="crviewer"%>
    <%
    // just a test to grab rpt name from GET
    String rptFile = "report_files/" + request.getParameter("rpt");
    %>
    <crviewer:viewer reportSourceType="reportingComponent" viewerName=""
    isOwnPage="true">
       <crviewer:report reportName="<%= rptFile %>" />
    </crviewer:viewer>
    Many thanks in advance!
    Mark

    I am not aware of any html tags you can pass to the viewer for parameter values.  Normally, you would load the report in code and then use the SDK with the report object to pass parameter values.

  • How to make SOAP call from jsp

    how can i make a SOAP call from JSP.
    I'm new to this.
    This is my requirement
    After the user logs in i need to make a soap call to a given url.
    i need to fill two values in the xml. i have the value with me.

    Although you could do it, why would you put this kind of logic into a presentation file like JSP? It depends on the API you want to use:
    Try this one:
    https://jax-ws.dev.java.net/
    MeTitus

  • How to pass an object as a parameter

    how do you pass an object as a parameter? (what type should it be ?)

    Well you can use a [url http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html]String
    Or you can take a [url http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Double.html]Double
    And you can pass [url http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Event.html]Events
    and get yourself in trouble
    and you can use a [url http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Frame.html]Frame
    or maybe take a [url http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html]List
    but some will use [url http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html]Collection
    depends you your direction
    so if you need to know
    if you should use a [url http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.html]Map
    then this is what to do
    just browse the [url http://java.sun.com/j2se/1.4.2/docs/api/]API

  • How to pass class object  as in parameter in call to pl/sql procedure ?

    hi,
    i have to call pl/sql proecedure through java. In pl/sql procedure as "In" parameter i have created "user defined record type" and i am passing class object as "In" parameter in call to pl/sql procedure. but it is giving error.
    so, anyone can please tell me how i can pass class object as "In" parameter in call to pl/sql procedure ?
    its urgent ...
    pls help me...

    793059 wrote:
    I want to pass a cursor to a procedure as IN parameter.You can use the PL/SQL type called sys_refcursor - and open a ref cursor and pass that to the procedure as input parameter.
    Note that the SQL projection of the cursor is unknown at compilation time - and thus cannot be checked. As this checking only happens at run-time, you may get errors attempting to fetch columns from the ref cursor that does not exist in its projection.
    You also need to ask yourself whether this approach is a logical and robust one - it usually is not. The typical cursor processing template in PL/SQL looks as follows:
    begin
      open cursorVariable;
      loop
        fetch cursorVariable bulk collect into bufferVariable limit MAX_ROWS_FETCH;
        for i in 1..bufferVariable.Count
        loop
          MyProcedure( buffer(i) );   --// <-- Pass a row structure to your procedure and not a cursor
        end loop;
        ..etc..
        exit when cursorVariable%not_found;
      end loop;
      close cursorVariable;
    end;

  • How to pass a "object" as a prameter from one java class to another java

    hi experts, I want to know "How to pass and get object as a parameter from one java class to another java class". I tried follwoing code just check it and give suggetions..
    import Budget.src.qrybean;
    public class ConfirmBillPDF extends HttpServlet
    qrybean db = new qrybean();
    SimplePDFTable pdfTable = new SimplePDFTable();
    pdfTable.simplePDFTableShow("2010","2011","1","2","1","131","102");
    }Here i want to pass db with simplePDFTableShow method. simplePDFTableShow is in another java class. So how can i do this.
    And also i want to know, how this obj will get.
    please help me.
    Edited by: andy_surya on Jul 14, 2010 7:51 AM

    Hi andy_surya
    what is this i am not understand
    pdfTable.simplePDFTableShow("2010","2011","1","2","1","131","102");but i am try to solve your problem try this
    qrybean db = new qrybean();
    SimplePDFTable pdfTable = new SimplePDFTable();
    pdfTable.simplePDFTableShow(db);and access like this in SimplePDFtable class update your method
    simplePDFTable(qrybean tempDB)
    // write your code
    }

  • How to pass JSON object for a PUT operation of restful

    Hi,
    I am trying to proxy restful call through an OSB proxy and I would like to know how I can pass json object via OSB proxy to an external rest service for a PUT operation? I am using Oracle 11g.
    I have created a business service, that point to the external rest service and created a proxy service that route to the business service. I thought it automatically takes the JSON, which is the data need to be send to the rest service, but didn't work, I get 405 error in the osb access log. is that how it works, or there is something else I need to do? if so, can you please help and tell me how?
    appreciate any kind of help.
    thanks
    Marwa.

    Hi Anju,
    Most of the example I see is dealing with data being pass either as query-string or html form. We are passing JSON object from the UI and rest services are configured to take JSON. therefore, in the PUT and POST data are passed either as an attachment or part of the request object. Do you know or have an example how to do it? I don't need to any kind of transformation of data because I need JSON on both end and I am trying to use the OSB proxy in between my UI and rest services to take advantage of monitoring capability of the OSB.
    appreciate any help, my deadline is getting close and I kind stuck.
    Thanks
    M.

  • Invoke- WmiMethod - How to pass input object

    How to pass inputobject to Invoke-WmiMethod? We tried the below it throws error
    $request = Get-WmiMethod -Class xx -NameSpace yyy -ComputerName zzz
    Invoke-WmiMethod -Name xxx -InputObject $request -ArgumentList $arg -Namespace yyy
    Error thrown because $request cannot be converted to ManagementObject.
    Please provide sample 

    Hi Rajalakshmi S,
    In addition, you got the error because you are passing it an array objects.
    Please try the script below:
    Get-WmiObject -Class Win32_Share -ComputerName $computer |
    foreach {
    “`n $($_.Name)”
    Invoke-WmiMethod -InputObject $_ -Name GetAccessMask}
    Reference from:
    https://richardspowershellblog.wordpress.com/about/
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support

  • How to pass an object as method parameter

    Hi Guys
    I was testing a simple program and was trying to pass an object to a method but it didnt seem to work and I couldnt find out WHY.
    I am posting the code so please let me know who can i make my method ADD_EMPLOYEE work so that when i pass an object of LCL_EMPLOYEE, it updates I_EMPLOYEE_LIST.
    *& Report:  ZOO_HR_SAMPLE_1
    *& Author:  Avinash Pandey
    *& Date:    25.03.2009
    *& Description: Concepts of OO in ABAP
    REPORT  zoo_hr_sample_1.
    *&       Class LCL_EMPLOYEE
           Local class
    CLASS lcl_employee DEFINITION.
    Public section
      PUBLIC SECTION.
    Data type
        TYPES:
          BEGIN OF t_employee,
            no  TYPE i,
            name TYPE string,
            wage TYPE i,
         END OF t_employee.
    Method
        METHODS:
          constructor
            IMPORTING im_employee_no TYPE i
                      im_employee_name TYPE string
                      im_wage TYPE i,
            add_employee
             IMPORTING im_employee TYPE REF TO lcl_employee,
           display_employee_list,
           display_employee,
           get_no EXPORTING ex_no TYPE i,
           get_name EXPORTING ex_name TYPE string,
           get_wage EXPORTING ex_wage TYPE i.
      Class methods are global for all instances
        CLASS-METHODS: display_no_of_employees.
    Protected section
      PROTECTED SECTION.
      Class data are global for all instances
        CLASS-DATA: g_no_of_employees TYPE i.
        CLASS-DATA: i_employee_list TYPE TABLE OF t_employee.
    Private section
      PRIVATE SECTION.
       CLASS-DATA: i_employee_list TYPE TABLE OF t_employee.
        DATA: g_employee TYPE t_employee.
    ENDCLASS.               "LCL_EMPLOYEE
    *&       Class (Implementation)  LCL_EMPLOYEE
           Text
    CLASS lcl_employee IMPLEMENTATION.
    Class constructor method
      METHOD constructor.
        g_employee-no = im_employee_no.
        g_employee-name = im_employee_name.
        g_employee-wage = im_wage.
        g_no_of_employees = g_no_of_employees + 1.
      ENDMETHOD.                    "constructor
    Method
      METHOD display_employee.
        WRITE:/ 'Employee', g_employee-no, g_employee-name.
      ENDMETHOD.                    "display_employee
    Method
      METHOD get_no.
        ex_no = g_employee-no.
      ENDMETHOD.                    "get_no
    Method
      METHOD get_name.
        ex_name = g_employee-name.
        WRITE: / 'Name is:' , ex_name.
      ENDMETHOD.                    "get_no
    Method
      METHOD get_wage.
        ex_wage = g_employee-wage.
      ENDMETHOD.                    "get_no
    Method
      METHOD add_employee.
      Adds a new employee to the list of employees
        DATA: l_employee TYPE t_employee.
        l_employee-no = im_employee->get_no.
        l_employee-name = im_employee->get_name.
        l_employee-wage = im_employee->get_wage.
        APPEND l_employee TO i_employee_list.
      ENDMETHOD.                    "add_employee
    Method
      METHOD display_employee_list.
      Displays all employees and there wage
        DATA: l_employee TYPE t_employee.
        WRITE: / 'List of Employees'.
        LOOP AT i_employee_list INTO l_employee.
          WRITE: / l_employee-no, l_employee-name, l_employee-wage.
        ENDLOOP.
      ENDMETHOD.                    "display_employee_list
    Class method
      METHOD display_no_of_employees.
        WRITE: / 'Number of employees is:', g_no_of_employees.
      ENDMETHOD.                    "display_no_of_employees
    ENDCLASS.               "LCL_EMPLOYEE
    REPORT
    DATA: g_employee1 TYPE REF TO lcl_employee,
          g_employee2 TYPE REF TO lcl_employee.
    START-OF-SELECTION.
    Create class instances
      CREATE OBJECT g_employee1
        EXPORTING
          im_employee_no   = 1
          im_employee_name = 'John Jones'
          im_wage          = 20000.
      CREATE OBJECT g_employee2
        EXPORTING
          im_employee_no   = 2
          im_employee_name = 'Sally Summer'
          im_wage          = 28000.
    Call methods
      CALL METHOD g_employee1->display_employee.
      CALL METHOD g_employee1->add_employee
        EXPORTING
          im_employee = g_employee1.
      CALL METHOD g_employee1->get_name.
      CALL METHOD g_employee2->display_employee.
      CALL METHOD g_employee2->display_no_of_employees.
    The error I am getting is:
    Field GET_NO/GET_NAME/GET_WAGE is unknown.
    Please help me out on this.
    Thanks a lot you people

    hi.
    The following parts of your program were changed.
    The result is OK?.
    *(1)change
    CLASS lcl_employee DEFINITION.
    Public section
    PUBLIC SECTION.
    display_employee,
    *get_no EXPORTING ex_no TYPE i,
    *get_name EXPORTING ex_name TYPE string,
    *get_wage EXPORTING ex_wage TYPE i.
    get_no returning value(ex_no) TYPE i,
    get_name returning value(ex_name) TYPE string,
    get_wage returning value(ex_wage) TYPE i.
    *(2)change
    CLASS lcl_employee IMPLEMENTATION.
    Method
    METHOD add_employee.
    Adds a new employee to the list of employees
    DATA: l_employee TYPE t_employee.
    *l_employee-no = im_employee->get_no.
    *l_employee-name = im_employee->get_name.
    *l_employee-wage = im_employee->get_wage.
    l_employee-no   = im_employee->get_no( ).
    l_employee-name = im_employee->get_name( ).
    l_employee-wage = im_employee->get_wage( ).
    APPEND l_employee TO i_employee_list.
    ENDMETHOD. "add_employee
    Result List
    Employee          1  John Jones
    Name is: John Jones
    Name is: John Jones
    Employee          2  Sally Summer
    Number of employees is:          2

  • How to Pass Java Objects between Web Dynpro and Java SAP iViews

    Basically I have an SAP web dynpro iView that I do stuff with and I want to pass an object to another iView which is just a regular Java iView. From what I've read and tried, I can't just stick something in the session object and hope that the Java iView can pull it down the other end. I had a dream that it was possible (seriously).
    Anyway, are there any possible solutions around? Please advice and share you throughts. I will try to dream about it again tonight and see if its really gonna work this time.
    thanks for your help in advance

    There is no easy way you can pass objects other than those supported by express such as String, map, list etc.
    Though not advised, you can create a class with static variables to handle the storage of such java objects during transition between form and workflow. You will need to somehow identify the objects uniquely .

  • How to pass back object to client?

    Forgive me if i ask too stupid question, but I really confuse what is really happen when it is not working.
    Firstly, client A pass several objects to the server one by one, and the server will have to wait untill another client (let call it client b) able to process this object, and pass it back to the client a.
    This object include some data that need to compute and save the result back to the object.
    In this case, I have write the code to enable the server to callback client a, when the object is processed. Rather then put it in a while loop to wait the result coming back.
    But I have difficult to trace back the original client. It cannot find client A and update the object.
    I already read the Stock, Time example (which is in Sun website), and follow it to develop my program, but I still cannot get it right.
    Does anyone know have any reference that I can look at or give some suggestion that can help.
    Thank in advance and wish you have a good day.
    Regards,
    Tai Tan

    Really thank you for your help.
    But i still unable to get it right.
    Can I ask you few more questions. thank.
    Can I know what the 'this' in the your example mean?
    try
       UnicastRemoteObject.exportObject( this );  //what is 'this' mean?
       obj = (Hello)Naming.lookup("//" + ser + ":5000/Server");
       message = obj.sayHello( this );  //what is 'this' mean?
    catch (Exception e)
         System.out.println("HelloApplet exception: " +
          e.getMessage());
         e.printStackTrace();
    }because the client program is not extends Applet, so if i put 'this' in the above 2 lines, it will not accept by the compiler.
    one more question, I put the client class in the first 'this' means:
    UnicastRemoteObject.exportObject( jobClient jc );  and passing second object in the second 'this':
    //message = obj.sayHello( this );
    mytemp.submitJob(jb1);
    // Note: mytemp is : 'static mainServer mytemp';
    // which is a remote object of the serverSo, is this the correct way to export the stub and object?
    (In the example that you give, the 'this' is the same. But in my program, the second 'this', I have to call submitJob(jb1) in the server, and passing the jb1 ( is a serialize object name call jobThread.)
    Thank again and sorry for giving you such trouble.

  • How to pass serialized object and the string through the socket together?

    I have an application which listens on a port and I usually read string lines from it. Now I want to pass serialised object through it , plus I should indicate (using some string like "object coming") tht the following packet is a serialized object.

    Since Strings are serializable you could just send a stream of serialized objects then you don't have to know anything about the format.

Maybe you are looking for

  • Reg iPhone Mail App (downloading of emails)

    Hi, Does iPhone download the entire email when we check for emails? Scenario: - Open iPhone mail app - receive 10 emails - open the email to read the contents - get 'loading' icon..seems as if that's when it's trying to get the email - the contents r

  • Difference between form 16 and 24

    Can anyone let me know in the simplest way, the difference bet form 16, 24 and 24Q? Edited by: tinku ray on Feb 2, 2009 9:28 AM

  • Level rules for nested codeblocks

    I am trying to modify the level rules to apply indentation to codeblock elements, which I have allowed for nesting so we can create good code samples. I have my level rules set up like this, but everything is still flush with the left margin when I a

  • Special characters when editing

    In a text area that others will be editing, I've used Ὕ for a non-breaking hyphen in the original source created in Dreamweaver. I'm wondering how an editor will enter a non-breaking hyphen. I use a Mac, but I've read that on a PC it can be entered w

  • Lost pictures after updating to IOS 7.

    After updating my iPhone 5 to IOS 7, I lost all the photos that had been stored on the phone. That was six months ago, and I have taken many more pictures I don't want to lose, either. Is there any way to retrieve these images from an old backup with