Objects through servlet

How to pass the object through servlet?

I can venture a guess that the OP wants to 'send' an object as a request parameter or a form field.
You'd have to turn the object into some data representation that can later on be translated back into the object; serialization comes to mind. It might be easier to just send the properties of the object as seperate request/form fields though!

Similar Messages

  • How to get an ArrayList Object in servlet from JSP?

    How to get an ArrayList Object in servlet from JSP?
    hi all
    please give the solution for this without using session and application...
    In test1.jsp file
    i am setting values for my setter methods using <jsp:usebean> <jsp:setproperty> tags as shown below.
    After that i am adding the usebean object to array list, then using request.setAttribute("arraylist object")
    ---------Code----------
    <jsp:useBean id="payment" class="com.common.PaymentHandler" scope="request" />
    <jsp:setProperty name="payment" property="strCreditCardNo" param="creditCardNumber" />
    <%-- <jsp:setProperty name="payment" property="iCsc" param="securityCode" /> --%>
    <jsp:setProperty name="payment" property="strDate" param="expirationDate" />
    <jsp:setProperty name="payment" property="strCardType" param="creditCardType" />
    <%--<jsp:setProperty name="payment" property="cDeactivate" param="deactivateBox" />
    <jsp:setProperty name="payment" property="fAmount" param="depositAmt" />
    <jsp:setProperty name="payment" property="fAmount" param="totalAmtDue" /> --%>
    <jsp:useBean id="lis" class="java.util.ArrayList" scope="request">
    <%
    lis.add(payment);
    %>
    </jsp:useBean>
    <%
    request.setAttribute("lis1",lis);
    %>
    -----------Code in JSP-----------------
    In testServlet.java
    i tried to get the arraylist object in servlet using request.getAttribute
    But I unable to get that arrayObject in servlet.....
    So if any one help me out in this, it will be very helpfull to me..
    Thanks in Advance
    Edward

    Hi,
    Im also facing the similar problen
    pls anybody help..
    thax in advance....
    Litty

  • Not able to retrieve data from database through servlet

    Hi friends,
    I am trying to open a excel sheet through servlet. In this servlet i am retriving data from mssql database.I am not getting any error but no data is retrived
    i m also pasting the code here
    // Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://www.kpdus.com/jad.html
    // Decompiler options: packimports(3)
    // Source File Name:   EmployeeData.java
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    public class EmployeeData extends HttpServlet
        public EmployeeData()
        public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
            throws ServletException, IOException
            httpservletresponse.setContentType("text/html");
            httpservletresponse.setHeader("Content-Type", "application/excel");
            httpservletresponse.setHeader("Content-Disposition", "filename=reports.xls");
            PrintWriter printwriter = httpservletresponse.getWriter();
            try
                javax.servlet.http.HttpSession httpsession = httpservletrequest.getSession(true);
                int i = 0;
             /*   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
                Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:3413;DatabaseName=newreportsodbc", "reportuser", "cisco");*/
                String url="jdbc:odbc:newreportsodbc";
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
                Connection connection = DriverManager.getConnection("jdbc:odbc:newreportsodbc","reportuser","cisco");
                Statement statement = connection.createStatement();
                printwriter.println("<b><center><u> Search Results </u></center></b>");
                printwriter.print("<table><tr><th color=brown background-color=#fff000>  No.  </th>");
                printwriter.print("<th> DateTime      </th></tr></table>");
           ResultSet resultset = statement.executeQuery("SELECT * FROM t_Call_Type_Half_Hour");
                boolean flag;
                for(flag = false; resultset.next(); flag = true)
                    i++;
                    SerialNo = resultset.getString(2);
                    printwriter.print((new StringBuilder()).append("<table><tr><td> ").append(i).append("</td>").toString());
                    printwriter.print((new StringBuilder()).append("<td> ").append(SerialNo).append("</td></tr></table>").toString());
                if(!flag)
                    printwriter.println("<h1> No records selected </h1>");
            catch(Exception exception)
                System.out.println((new StringBuilder()).append("SQLException: ").append(exception).toString());
        static String empid1;
        static String empid;
        static String SerialNo;
        static String designation;
    }thanks in advance. i just feel there is something to be done with connection string.

    post the table format in SQL

  • Store Image through Servlet

    I want to store a JPG image into database column through Servlet
    and dispaly it on a JSP page through Beans
    how can i ?

    Any requests made to a JSP are of a certain content. Generally you make a request to a JSP page it sends back a "text/html" document. There is noi binary data as such just text.
    Images on a page are displayed because the "src" attribute of the image tag points to a server location. This in turn returns content of type "image/*".
    A servlet can retrieve/generate your images for you for example you could point to a servlet:
    <img src="/system/imageServlet">
    I guess a JSP can do the same (I've never tried it) just remember to set the response.contentType to "image/gif"/"image/jpg".....
    Cheers,
    Anthony

  • Problem in opening .ics and .vcs file types through servlet in IE browser.

    I'm having problem in downloading an .ics and .vcs file through servlet in I.E browser. It is happening fine in Mozilla firefox(they both are getting opened in OutLook), but in IE it says as undefined file type.
    I'm using Content Type as : 'text/Calendar' and then setting header as :
    response().setContentType("text/Calendar");
    response().setContentLength(file.length());
    response().setHeader("Content-Disposition", "attachment;
    filename="+filepath);
    and after that i'm writing it to OutPut stream.
    Plz Help.

    Hi,
    On page load check whether the session values are there. If not redirect the user to the login page.
    Hope this helps,
    Regards,
    Sammani

  • How to send data to bam data object through java code

    how to send data to bam data object through java code

    I've made a suggestion in other thread: https://forums.oracle.com/thread/2560276
    You can invoke BAM Webservices (Using Oracle BAM Web Services) or use JMS integration using Enterprise Message Sources (http://docs.oracle.com/cd/E17904_01/integration.1111/e10224/bam_ent_msg_sources.htm)
    Regards
    Luis Fernando Heckler

  • Accessing setters in parent view object through view link

    Hi,
    I want to access the setters in a parent view object from a child view object through the view link. I have not been able to find an example, can someone point me to one? This is possible isn't it?
    Thanks,
    Jim

    Hi,
    have a look at the developer guide, it has one
    http://download-uk.oracle.com/docs/html/B25947_01/toc.htm
    Frank

  • How to organize the context object through out the application process

    Hi,
    Here in my application is using the following steps for a process.
    - Login
    - Search
    - Update
    - Logout
    In those above steps, Login, Search, and Update actions are touching to database/LDAP every time. In each time, Im creating new Context object, I think this is a bad approach. When I hit the login, I need to get the connection object and use that for rest of the actions(search and update).
    So can we organize the single context object through out the application? And where do we need to close the Context object?

    Don't worry about it. The provider will reuse connections behind the scenes. They're not tied directly to Contexts.

  • Insert Arabic through Servlet

    Hi,
    I am able to read Arabic characters through servlets and able to display in a browser .
    But when I try to insert Arabic characters to Oracle Database through servlets ,
    it is saved as ??????? or inverted question marks
    Kindly help me resolve this issue.
    Thanks and Regards
    Jailani

    and since email replies won't work with the "<>" chars in them:
    in application.cfm
    <cfset setEncoding("url","UTF-8")>
    <cfset setEncoding("form","UTF-8")>
    <cfcontent type="text/html; charset=UTF-8">
    at the top of your cf pages add:
    <cfprocessingdirective pageEncoding="UTF-8">

  • Oracle NoSQL through Servlet.

    Hello Everyone,
    I am trying to execute the nosql operations on server through servlet. I want to make an client server application but dont know why the CONNECTION TO KVSTORE IS NOT ESTABLISHED WHILE EXECUTING ON SERVLET.
    So is there any separate configuration needed to do so?
    Thanks In Advance.

    Could you be more explicit please?  What is the exact error you are seeing?
    Please explain in detail what is the issue you're facing.
    If you want to access an Oracle NoSQL Database KVStore through a servlet the best way would be to use a ServletContextListener in your web app that gets the KVStore handle and places it in application/context scope as an attribute (so that all servlets and JSPs would have access to it) and also closes the handle when the web app gets shut down.  You could even supply the store name, store host name and store host port (the helper host port -- hostName:hostPort) through the web.xml web app config file.
    Here is a simple example of such a ServletContextListener:
    import javax.servlet.ServletContext;
    import javax.servlet.ServletContextEvent;
    import javax.servlet.ServletContextListener;
    import javax.servlet.annotation.WebListener;
    import oracle.kv.KVStore;
    import oracle.kv.KVStoreConfig;
    import oracle.kv.KVStoreFactory;
    * KVStoreClientContextListener implements ServletContextListener, hence it will be
    * invoked when the application context is initialized and destroyed.
    * @author Andrei Costache
    @WebListener
    public class KVStoreClientContextListener implements ServletContextListener {
        @Override
        public void contextInitialized(ServletContextEvent sce) {
            ServletContext sc = sce.getServletContext();
            KVStore ondbstore = null;
            try {
                // Try to get the store name, store host name and store host port from web.xml,  as context attributes.
                // If they are not available, then default to the values specific to a default KVLite instance.
                String storeName = (String) sc.getAttribute("storeName");
                String hostName = (String) sc.getAttribute("hostName");
                String hostPort = (String) sc.getAttribute("hostPort");
                if (storeName == null) {
                    storeName = "kvstore";
                if (hostName == null) {
                    hostName = "localhost";
                if (hostPort == null) {
                    hostPort = "5000";
                // Get the KVStore and place it as an atribute in application/context scope.
                ondbstore = KVStoreFactory.getStore(new KVStoreConfig(storeName, hostName + ":" + hostPort));
                sc.setAttribute("ondbstore", ondbstore);
            } catch (Exception e) {
                sc.log("Could not get a KVStore instance");
        @Override
        public void contextDestroyed(ServletContextEvent sce) {
            KVStore ondbstore = null;
            ServletContext sc = sce.getServletContext();
            try {
                ondbstore = (KVStore) sc.getAttribute("ondbstore");
                if(ondbstore != null) {
                    ondbstore.close();
            } catch (Exception e) {
                sc.log("Could not successfully close the KVStore handles");
    In your servlets or JSPs you will simply retrieve the KVStore handle from the servlet context, where it is found as a context scope attribute:
    KVStore ondbstore = (KVStore) getServletContext().getAttribute("ondbstore");
    and do whatever operations you want using the KVStore handle.
    You will need the NoSQL Database kvclient.jar -- either your web container / application server can load it, or you could copy it under the WEB-INF/lib directory so that it gets loaded when your web app gets deployed and started.  (kvclient.jar is found under kv-M.N.P/lib).
    Regards,
    Andrei

  • How to create object through  transaction snro

    Hi ,
       I want to create an object through Snro transaction.
    I dont know how to use this transaction.
    Please Help.
    Thanks in advance.
    Nikita

    Nikita,
    Based on the transaction code, respective function consultant will create number range.
    If u want a number series for some other purpose in ur program u can create object in snro as below.
    1. Enter a object name and click 'CREATE' button
    2. In the next screen give relevant description
    3. In 'Number length domain' field u can specify the length of number .. example if u give char10, then it will be a ten digit number series.
    4.Enter warning percentage.. the purpose is to throw warning message 10 % before when ur number series about to exhaust.
    5. After entering those details --> press save button.
    6. Again come to main screen (SNRO initial screen) then click number raneg tab inthe application tool bar.it will take u to next screen.
    7. In that click internal change push button
    8. IN the resulting screen enter ur number range series,
    example
    01     00000001     09999999
    02     10000000     19999999 etc
    9. click save button..NOw ur number series is ready for use.
    Regards,
    Aswin.

  • Running an executable file through servlet

    Hello People,
    I tried searching about this on the Forums, but could not find the right solution.
    Please donot get annoyed if you find this to be a repeted topic, which I am sure is not.
    I want to run a .sh file in Unix environment through servlet.
    Actually i want to do this inorder to schedule a report servet to run a report and generate the output in a particular format on a click of a button.
    I tried using Runtime.getRuntime().exec method, (which I know through forum is unreliable)
    Can anyone suggest me a method through I can achieve this?
    Any suggestion is appreciated.
    Regards,
    Rohan Kamat

    Hi MOD,
    Thanks for the quick reply.
    Heres what I am doing to schedule.
    1) The client selects the necessary parameters from the front end and then saves it in a table.
    2) This he will be doing for as many reports as he wants, on an average there will be 200 reports daily.
    3) Once he has selected all the parameters for all the reports, he will go to the next screen and fire a script to run the reports at a time.
    4) This script will be fired only once. And once it is fired it will generate a PDF files of the reports.
    5) On the front end the screen will be refreshed showing the users the status of the reports that he has scheduled to be run
    I am using Servlets 2.0 version, and jdk.12
    Regards,
    Rohan Kamat

  • Transport of PCD and Content objects through JDI.

    Hi all,
    Pls share the views about the trasport procedure for PCD and Content objects.
    Is it possible to transport PCD and Content objects through JDI?
    If it is possible, could you pls share how to configure the JDI setup?
    Thanks in advance,
    Kishore.

    Hi Kishroe,
    First, there is no supported, out of the box way to handle content objects in the JDI (now NWDI- NetWeaver Development Infrastructure) With that said, since it is a repository you could export your content package. Make it a zip file or something like that and add it to the repository.
    Again, I believe this is theoretically possible. I'm sure some of the other SDN members can provide an automated approach to do this.
    Good luck,
    John

  • Working with markups through servlet

    Hello,
    There is several problems with using Autovue through servlet.
    Fabula:
    Servlet receives http request, connect to the vue server (vue servlet via ServerControl), load .dwg file into
    vuebean by vuebean.setFile(new DocID(fileName)) and load markup by simple calling markupbean.readMarkup(FileInputStream instance) method.
    I get a markup file name by parsing 'markups.map'. Servlet modifies markup by http request parameters (set new FillColor, for example) and saves markup file -
    markupbean.writeMarkup(FileOutputStream) - very simple process.
    Problems:
    1. After markup changing i need to open dwg with markup (in applet), but i don't know how i can to do this. jVue.openMarkup() doesn't work - i don't understand what parameters are needed.
    2. When markup open via jVue applet GUI, changed TextBox elements are not visible, but presents in markup items list.
    If TextBox is selected it becomes visible! If I change the text or position of TextBox, it will become visible (without selection). This situation applies only to TextBoxes.
    Any suggestions how I can load markups into GUI and fix visibility of TextBoxes after saving via FileOutputStream.

    Hello,
    May I point out some issues where you are implementing code that is not supported nor documented (and probably will not) and consequently help on those topics is not available
    1. I get a markup file name by parsing 'markups.map' -> not documented, not supported, could change on any release.
    2. markupbean.writeMarkup(FileOutputStream) -> where? local datastore is not documented, will need synching, writing to it directly not supported, could change on any release.
    Stating it as a simple action is probably not the best way to describe a over-complicated solution piggybacking on a closed (undocumented) implementation
    Hence my recommendation for an open and properly documented platform
    Perhaps you should have started by describing what you are trying to do
    If what you want to implement is to save markups with a predefined name, then your solution is an overkill (and goes in the wrong direction)
    If you would be kind enough to
    1. follow this forum's rules ie https://forums.oracle.com/forums/ann.jspa?annID=1527
    2. properly state what you are trying to implement in another thread, if possible as it will make search/review easier to the rest of the community
    3. Have a tittle that is descriptive enough
    4. is this solution required to work on a cluster (ie more than one AV server)?

  • Displaying Images through Servlets

    I am using Servletrunner utility to run my servlets. How can I display Images along with other HTML text, to the Browsers through Servlets?

    Print out the <img> tag. The URL you use may in turn reference another servlet that produces an image. You can look at the Java2D (and perhaps Java3D, if you want 3D images) to help you produce the images.

Maybe you are looking for