How to print contents in an object?

I would like to print content of object as it is printing like AccountSearchReqBOD@726d23. AccountSearchReeqBOD is generated by ant task clientgen which is not overriding toString method. how can i print contents in an object. Plz help me..
Thanks in advance.

i tried with reflection as below
public String toString1(Object obj)
     StringBuffer buff = new StringBuffer();
     Field[] fields = obj.getClass().getDeclaredFields();
     for (int i = 0; i < fields.length; i++)
     try
     fields.setAccessible(true);
     buff.append(fields[i].getName())
     .append("\t=>\t")
     .append(fields[i].get(obj))
     .append("\n");
     //System.out.println(fields[i].getName() + " : values: " +
     // fields[i].get(this));
     catch (IllegalAccessException ex)
     ex.printStackTrace(System.out);
     catch (IllegalArgumentException ex)
     ex.printStackTrace(System.out);
     return buff.toString();
     * Method logRequest<p/>
     * Logs a SOAP request.
     * @param request
     private void logRequest(Object request) {
          if (mLog.isDebugEnabled()) {
               if (request != null) {
                    mLog.debug("request:");
                    mLog.debug(toString1(request));
               } else {
                    mLog.debug("request is null");
But the above also doesn't log the object with in object. it gives log as
2011-02-08 12:31:44,170 - DEBUG (WSClient:1168) - request:
2011-02-08 12:31:45,405 - DEBUG (WSClient:1169) - hostInput     =>     HostInput
2011-02-08 12:32:08,935 - DEBUG (WSClient:1186) - response:
2011-02-08 12:32:10,060 - DEBUG (WSClient:1187) - processService     =>     com.tfs.tfs.sharedcomponents.serviceschemas.hostavailable.hostavailableressync.ProcessService@1d43cab
Request is in correct format but response object got another object as processService which is not outputting correctly. Please help me..
Edited by: user8660327 on Feb 8, 2011 2:25 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • What's the best way to print content of javax Object (JTable for example)?

    Hi there,
    1) I would like to know the best way to print content of jtable (for example)
    2) I would like to know how can I Print content of SQL statment (for example "SELECT ID, NAME FROM COMPANY")?
    Best Regard,
    Eyal
    [email protected]

    Depends on what you want printed. You can do something like System.out.println(myTable);but you may not like what you see. If you want to print anything else, extend JTable and create a new toString() method that prints out what you want.
    As for printing a SQL statement - assuming it is in a String, you can just do System.out.println(mySQLStatement);

  • How to print content of the swing components?Example:JTextArea.

    I have a application,it include a JTextArea,and when user click newfile menu,
    it will load a txt file.but how can I print the txt file content? now ,I can only
    print the panel of the application!
    Thank you!

    Next is the code of the PrintManager I have written. It uses the new Printing technique.
    package jippa.jshell.gui;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintException;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.SimpleDoc;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.MediaSizeName;
    * @author postma
    * To change the template for this generated type comment go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    public class PrintManager {
         * Constructs a new PrintManager.
         public PrintManager() {
              super();          
         * Print the given text.
         * @param text The text to be printed.
         public void print(String text) {
              DocFlavor df = DocFlavor.STRING.TEXT_PLAIN;
              Doc myDoc = new SimpleDoc(text, df, null);
              PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
              aset.add(MediaSizeName.ISO_A4);
              PrintService[] services =
                   PrintServiceLookup.lookupPrintServices(df, aset);
              if (services.length > 0) {
                   DocPrintJob job = services[0].createPrintJob();
                   try {
                        job.print(myDoc, aset);
                   } catch (PrintException pe) {
                        pe.printStackTrace();
    In your code you must add:
    PrintManager pm = new PrintManager();
    pm.print(text);

  • How to print content inside a scroller in Adobe Air

    Hi experts,
    I am currently working on an Adobe AIR application that shows the  user some graphical data. As this data is more in height to fit the  screen height, I've placed it inside a scroller.
    Now I want to take a print of this visual data, mostly some charts  and lists but I only see a single page containing only the part of the  screen that is currently visible to the user. I want to have the entire  content inside the scroller to appear on the page.
    I tried using both PrintJob and FlexPrintJob but couldn't find a way  around. Can anyone please help me by providing an insight, some source  code will be greatly appreciated.
    Looking forward to your replies,
    Thanks

    Alex,
    From http://www.darronschall.com/weblog/2005/11/the-secret-to-printing-in-flex.cfm,
    I adjusted my code to
            if (printJob.start())
                FlexGlobals.application.contentGroup.clipAndEnableScrolling = false;
                results.scroller.viewport.clipAndEnableScrolling = false;
                setTimeout(continuePrinting, 250)
            function continuePrinting():void
                printJob.addPage(results.scroller.viewport as Sprite);
                printJob.send();
                results.scroller.viewport.clipAndEnableScrolling = true;
                FlexGlobals.application.contentGroup.clipAndEnableScrolling = true;
    Now it does print a small portion of invisible portion, but the view of limited to a single page. I observed the contentHeight property of the viewport and it is 6097. But the printout is limited to a single page. I also tried giving a rectangle as the second parameter for the addPage method of printJob giving the height of viewPort.contentHeight but of no use.
    How are you suggesting to create a new view of viewport outside the scroller ? Can you please paste some code for reference for better understanding of your suggestion?
    Thanks

  • How to print content of attachments in PDF when clicked on print.

    Hi @,
    I have a requirement where when i click on print the content of attachment present in PDF should be printed instead of attachment symbol. Please let me know whether this is acheivable by any means.This should be done using .NET 2005.
    Thanks in advance.
    Regards
    Meenakshi.

    if you have have a bunch of questions, you can have a div tag set up with nothing in it after each question where you can display the answer. then when you click on the answers in the child window, you can do this:
    window.opener.document.getElementById('divName').innerHTML = 'the html/text to show';

  • How to print content of JSP

    hi ,
    i have a JSP with content beyond the limit of offset( with scroll bar, i have data after width of screen)
    with window.print i can not print the whole document
    any way to do that?
    please help me with some way........

    with .CSS also we can not make it out, right?
    any way?

  • How to print out contents of an object

    Hello, I am having a problem printing out the contents of an object I have created.
    ListReturn test = new ListReturn("ADMNTEST", "JUL", "2002", con);
    System.out.println(test);I see this:
    com.home.tools.reporting.ListReturn@6cd7d5
    But my "test" varible should be populated with a collection. How can I print out my object????

    One of the methods in your Object should be public String toString().
    In this method, iterate over the collection in your object and print out the bits of readable data you think would be useful to display and append it to the end of a String that you return.

  • How to print the properties in an object

    I have the following method that is meant to print all the details in a hashmap (allStudents). this hashmap contains references to objects of different students.
    what i need is to be able to print each object stored in allStudents, and each of those objects properties....
    Please show me the light!!!
        public void printAllStudents()
        for (Integer eachStudent : allStudents) //for each loop
             System.out.println(eachStudent);// prints out every element in set
        }

    Hi Kaj,
    So when I overide the toString method, and then call
    another method that prints out the contents of the
    objects held a Map, the toString formatted text is
    used? If so.. how does that work?For objects (as opposed to primitives), System.out.println() calls the toString method.

  • How to print PreparedStatment object in console

    Dear All
    i am using PreparedStatment for inserting data into a table, in my local system it is working fine, but after deploying in JBoss(Server) it is throwing "invalid column type" error. In order to check i tried to print in the JBoss console but i am unable print in the console, kindly help me regarding this.
    The code which i used is:
    PreparedStatement stmtPrep = conn.prepareStatement(sql);
    try {
    stmtPrep.setObject(1, number);
    stmtPrep.setObject(2, (String) passList.get("PlantCode"));
    stmtPrep.setObject(2, (String) passList.get("PlantExt"));
    stmtPrep.setObject(3, ls_per_ord_qty_ind);
    stmtPrep.setObject(4, ls_price);
    stmtPrep.setObject(5, (String) inList.get(4));
    stmtPrep.setObject(6, (String) List.get("txtStoreLoc"));
    stmtPrep.setObject(7, (String) List.get(1));
    h = (String) List.get("Price");
    float unit = Float.valueOf(h.trim()).floatValue();
    stmtPrep.setFloat(8, unit);
    System.out.println(">>>Query is>>>>>"+stmtPrep);
    Can any one guide me how to print in JBoss console this stmtPrep and check all the values that i am passing r correct r not.
    but it is throwing like this:
    15:16:30,686 INFO [STDOUT] >>>Query is>>>>>org.jboss.resource.adapter.jdbc.Wrap
    pedPreparedStatement@1056bdd

    sasikrishna wrote:
    Dear All
    i am using PreparedStatment for inserting data into a table, in my local system it is working fine, ok.
    but after deploying in JBoss(Server) it is throwing "invalid column type" error. That would seem to be a database problem to me. Schema specifically.
    In order to check i tried to print in the JBoss console but i am unable print in the console, Why does it matter since it will not help you?
    Your code specifically details the object types that you are setting.
    Presumbly the 'sql' is just a hard coded value.
    Consquently the conclusion is that the database on your local box versus the deployment is different. And nothing that you print in JBOSS will help you discover what the difference is. You need to look at the 'sql' and determine the entities from that and then compare them in the schema for both places.
    check all the values that i am passing r correct r not.As noted if that isn't a security violation for your application then you are left with the following.
    - Drivers do not necessarily create SQL.
    - If they do AND the driver is up to date then there is a method (look for it in the javadocs) that will return it
    - If not you should use a jdbc wrapper proxy that consumes the data for you. This might be better even if the driver does it.

  • How to print window contents at the backside of a page(In scripts&smartform

    Hi,
    How to print the window contents at the back side of a page
    in scripts and smartforms?
    regards,
    prajwala

    Create a new page with the window and select "duplex" printing. Use Search button to get more information.

  • How to print HTML contents

    can anyone tell me how to print HTML contents...i needed it urgently
    Thanks

    actually i have a print button on html page....when i click on print button using window.print(); the html page gets printed...but along with it print button is also printed...i dont want print button to be printed...
    this is the issue...
    please resolve it
    Thanks a lot...

  • How to print Iview contents only

    Hello All,
    How to print IView contents only instead of the whole portal. If I use javascript function, it prints whole screen. I want to print only the IVIEW contents. IView has tableview.
    Thanks in advance,
    Praveen

    Hi,
    we are using a 7.0 SP 16 Portal.
    If you have an light portal with an low EPCF level maybe the option will not be shown.
    Try it with the default SAP Portal Style as admin in that case you have an high EPCF level and you also should see the print option.
    If your iview is embeded inside a page this can have different effects. Please test it with an stand alone iView before.
    So with the high EPCF level the default portal style a single portal iView and the print option set to true you should see and use the print option.
    The option "Show print option" is not for every iView type avaible for example web dynpro iViews has that option this i know for sure, because i use this option with web dynpro iViews.
    Maybe you can build this function by your own i did this also with the following code. Maybe you can adapt that code:
    String p1 = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("PagePath");
    String p2 = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("sap-ext-sid");
    String p3 = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("sap-wd-cltwndid");
    String[] url = wdThis.wdGetAPI().getComponent().getApplication().getURLService().getGeneralService().getAbsoluteWebResourceURL(wdThis.wdGetAPI().getComponent().getDeployableObjectPart().getName()).split("/");
    parameter = p1 + "&iview_mode=default&sap-wd-renderMode=print&sap-wd-cltwndid=" + p4 + "&sap-wd-cltwndid-print=" + p4 + "&sap-wd-pb-ext-sid=" + p2 + "--" + p3 + "--&IviewPrint=true";
    String newUrl = "http://" + url[2]+ "/irj/servlet/prt/portal/prtroot/com.sap.portal.pagebuilder.IviewModeProxy?iview_id=" + parameter;
    kind regards
    Fabian
    Edited by: Fabian Eidner on Mar 23, 2009 3:40 PM

  • How to print the image data stored in object of 'java.io.File' Class in jsp

    I have created a file object for the image file in the system temporary directory.Now I want to display it in my page. please tell,How to print the image data stored in object(in my program it is imgr) of 'java.io.File' Class in jsp

    Create a servlet which gets an InputStream of the file and writes it to the OutputStream of the response and call this servlet in `src` attribute. That's basically all.
    Here's an example which covers the most of the minimum needs: [http://balusc.blogspot.com/2007/04/imageservlet.html].

  • Been using Macs since classic. Using MBP, OS 10.7.5. Trying to figure out how to print/save folder contents (Name, Date Modified, Size Kind) of entire (non-visible) folder? Any apps that can do this?

    Been using Macs since before classic. Using MBP, OS 10.7.5. Trying to figure out how to print/save folder contents including what's not visible on screen (Name, Date Modified, Size Kind) in entire folder?
    Screen shots are getting old hat.
    Tried select all, copy, paste into pages, but it didn't display date modified, size & kind, and also included images of selected files, which is too large. 
    Any apps/shortcuts/utilities that can do this?  Thanks in advance.

    Hello Achates:
    I did not read the rather long post. If you wish to reinstall OS X 10.4, use your software install DVD. Backup is essential. To minimize your risk, I would use an archive and install:
    http://docs.info.apple.com/article.html?artnum=107120
    In that way, you will have a fresh copy of OS X and your current settings will be preserved.
    Incidentally, I do not agree that the printer problem is best solved by reinstalling OS X. I have had HP printers for sometime and, on one occasion, had difficulty after an upgrade. HP technical support walked me through uninstalling all traces of the HP driver and then reinstalling.
    Barry

  • How to print current screen content to printer?

    Hi,
    After I run some report, some contents may be displayed on the screen, If I click the button 'PRINT', the contents can be printed to spool without dialogue screen.
    My question is,
    How to print the contents to spool with ABAP/4 program, just like the operator clicked the button 'PRINT'?
    Thanks and best regards.

    Hello,
    Check thsi sample report.
    REPORT ZV_CREATE_SPOOL .
    DATA : X_NAME       LIKE TSP03D-NAME,
           X_DEST       LIKE TSP03D-PADEST VALUE 'LOCL',
           X_ROWS       LIKE SXPCKLSTI1-BODY_NUM VALUE 0,
           X_STARTROW   LIKE SXPCKLSTI1-BODY_START VALUE 1,
           X_PAGES      LIKE RSPOTYPE-PAGES VALUE 1,
           X_PAGES_1    TYPE P DECIMALS 2,
           X_RQTITLE    LIKE SXPCKLSTI1-OBJ_DESCR,
           X_RQCOPIES   TYPE I VALUE 1,
           X_RQOWNER    LIKE TRDYSE01CM-USERNAME,
           X_IMMEDIATE  LIKE PRI_PARAMS-PRIMM VALUE ' ',
           X_RQID       LIKE TSP01-RQIDENT,
           I_CONTENTS    LIKE  SOLISTI1 OCCURS 0 WITH HEADER LINE.
    X_PAGES   = 1.
    X_RQOWNER = SY-UNAME.
    X_DEST     = 'LOCL'.
    X_STARTROW = 1.
    X_RQCOPIES = 1.
    X_IMMEDIATE = ' ' .
    I_CONTENTS-LINE = 'I Got your Childhood PHOTO'.
    APPEND I_CONTENTS.
    CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
    EXPORTING
    *       name                 =   x_name
        DEST                 =  X_DEST
        ROWS                 =  X_ROWS
        STARTROW             =  X_STARTROW
        PAGES                =  X_PAGES
        RQTITLE              =  X_RQTITLE
        RQCOPIES             =  X_RQCOPIES
        RQOWNER              =  X_RQOWNER
        IMMEDIATELY          =  X_IMMEDIATE
        IMPORTING
        RQID                 =  X_RQID
        TABLES
        TEXT_DATA            = I_CONTENTS
        EXCEPTIONS
        NAME_MISSING         = 1
        NAME_TWICE           = 2
        NOT_FOUND            = 3
        ILLEGAL_LAYOUT       = 4
        INTERNAL_ERROR       = 5
        SIZE_MISMATCH        = 6
        OTHERS               = 7.
    IF SY-SUBRC <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.      ENDIF.
    ENDIF.
    WRITE: 'I Got your Childhood PHOTO'.
    WRITE: X_RQID
    Regards,
    Vasanth

Maybe you are looking for