How-to bind binary data into textbox

can i bind binary data into the textbox....
coz..i get human unreadable character
[B@184b867#     binary data - byte array
supposingly ..i just need to convert to bytes.toString() to see the content...
yet i try but..it still return this weird character...any idea...
OutMailBean outMailBean = new OutMailBean();
outMailBean.setHost(request.getParameter("SMTP").trim());
outMailBean.setPort(request.getParameter("port").trim());
outMailBean.setMessages(request.getParameterValues("message"));    //string[]
//convert to byte array
outMailBean.setMessage(util.convertStringBufferToByteArr(bean.getMessages()));
//insert into table
Statement stmt = con.createStatement();
try {
ResultSet rs = stmt.executeQuery(squery);
try {
while (rs.next()) {
OutMailBean outMailBean = new OutMailBean();
outMailBean.setEmailId(rs.getString("EMAILID"));
outMailBean.setDateIn(rs.getString("DATEIN"));
outMailBean.setMessage(rs.getBytes("MESSAGE"));
System.err.println(rs.getBytes("MESSAGE").toString());
       //this will return human unreadable form........
OutMailAckBean outMailAckBean = new OutMailAckBean();
outMailAckBean.setAckDelivery(rs.getString("ACKDELIVERY"));     
outMailAckBean.setReceipient(rs.getString("RECEIPIENT"));
beanList.add(outMailBean);
beanList.add(outMailAckBean);
                    } finally {
                         rs.close();
               } finally {
                    stmt.close();
Message was edited by:
        yzme yzme
Message was edited by:
        yzme yzme

Hi yzme,
You need to convert the binary data to characters, a String, before you can properly display it. You say that <i>System.err.println(rs.getBytes("MESSAGE").toString());</i> prints human unreadable stuff. Maybe you need to use another character encoding, like this
byte[] message = rs.getBytes("MESSAGE");
String s = new String(message, "UTF-8"); // or "ISO-8859-1"
It all depends on how the original email message, presumably text, was stored in the database. There's no general way to convert a byte[] to a String and vice versa.
BTW, if you populate your OutMailBean using <i>outMailBean.setMessages(request.getParameterValues("message"));</i> then you're actually saying an email can have several messages and OutMailBean contains a <i>String[] messages</i> attribute. Then, you call the <i>outMailBean.setMessage</i> method which implies an email has one message and according to you comment OutMailBean contains a <i>byte[] message</i> attribute. The question is of course how you convert the <i>String[] messages</i> attribute to the <i>byte[] message</i> attribute. In other words, what does <i>util.convertStringBufferToByteArr</i> exactly do? It doesn't even convert a <i>StringBuffer</i>, but a <i>String[]</i>. What you probably want to do is something like
//OutMailBean bean
String[] messages = bean.getMessages();
StringBuffer sb = new StringBuffer();
for (int j = 0; j < messages.length; j++) {
  sb.append("message ").append(j).append("rn");
  sb.append(messages[j]).append("rnrn");
bean.setMessage(sb.toString().getBytes("UTF-8"));
Kind regards,
Sigiswald

Similar Messages

  • How to convert Binary Data into XML ???

    I am calling the getTaskInfo method of TaskManagerService class using Web Service API.
    The result includes the formdata in two formats:
    1.  Binary content of the form
    2.  Remote URL of the form data
    I have to find a value of a particular field using one of the above information.
    I am unable to convert the binary data to XML directly. I have also tried fetch the document based on remoteURL parameter which is also not working.
    Any suggestions are highly appreciated.
    Thanks
    Nith

    Hi Steffen,
    I found the same solution and fixed the issue long time back. Just forgot to close this forum topic.
    Thanks for your knowledge sharing.
    Nith

  • How to put data into textbox using JSP

    How can I put data into a textbox using JSP?
    This code prints to a html page but I want it inside an text area:
    // Print out the type and file name of each row.
            while(ftplrs.next())
                int type = ftplrs.getType();
                if(type == FtpListResult.DIRECTORY)
                    out.print("DIR\t");
                else if(type == FtpListResult.FILE)
                    out.print("FILE\t");
                else if(type == FtpListResult.LINK)
                    out.print("LINK\t");
                else if(type == FtpListResult.OTHERS)
                    out.print("OTHER\t");
                out.print(ftplrs.getName() +"<br>");
            }I have tried with the code below:
    <textarea name="showDirectoryContent" rows="10" cols="70">
    <%
           // Print out the type and file name of each row.
            while(ftplrs.next())
                int type = ftplrs.getType();
                if(type == FtpListResult.DIRECTORY)
    %>
                    <%= "DIR\t" %>
    <%            else if(type == FtpListResult.FILE) %>
                    <%= "FILE\t" %>
    <%            else if(type == FtpListResult.LINK)  %>
                    <%= "LINK\t" %>
    <%            else if(type == FtpListResult.OTHERS) %>
                    <%= "OTHER\t" %>
    <%            String temp = ftplrs.getName() +"<br>");
                  <%= temp > <br>
    %>
    </textarea>I get the following error:
    Location: /myJSPs/jsp/grid-portal-project/processviewfiles_dir.jsp
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:151: 'else' without 'if'.
    else if(type == FtpListResult.FILE)
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:165: 'else' without 'if'.
    else if(type == FtpListResult.LINK)
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:179: 'else' without 'if'.
    else if(type == FtpListResult.OTHERS)
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:193: ';' expected.
    String temp = ftplrs.getName() +"");
    ^
    4 errors, 1 warning
         at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)
         at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)
         at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)
         at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
         at java.lang.Thread.run(Thread.java:536)
    Please help???

    Yes indeed this works:
    <textarea name="showDirectoryContent" rows="10" cols="70">
    <%
           // Print out the type and file name of each row.
            while(ftplrs.next())
                int type = ftplrs.getType();
                if(type == FtpListResult.DIRECTORY)
    {%>
                    <%= "DIR\t" %>
    <%}            else if(type == FtpListResult.FILE)  {%>
                    <%= "FILE\t" %>
    <%}            else if(type == FtpListResult.LINK)  {%>
                    <%= "LINK\t" %>
    <%}            else if(type == FtpListResult.OTHERS) %>
                    <%= "OTHER\t" %>            
                  <%= ftplrs.getName() %>
    <%
    %>

  • How to output binary data to VISA

    i am interfacing labview with pic microcontroller through serial port using VISA. it is a stream of digital data which is being tranmitted ,stored in microcontroller and then retransmiited by microcontroller to other device...problem is when that data is converted to string to be given to VISA it makes 16bytes out of 16bits...for example if data was "11110000" (1byte) after converted to string it becomes 8 bytes and my microcontroller thibk that 8 bytes are coming................ please kindly tell me how to transmit binary data over serial port so that bit remains a bit dont become byte............................ data is 99bytes but after passing through VISA it become "99x16"bytes........ please help me
    regards
    umair

    The attached example in 8.0 converts a U16 into two U8, builds an array and with the Byte Array to String, converts to the hex string 8000 (two bytes). Note that the string indicator is configured for Hex Display (right click option).
    Now, when you say you want to see '1000001 on the hyperterminal of other PC', you are contradicting yourself. Hyperterminal cannot be set for binary display so if you want to see '10000001' in Hyperterminal, then you need 8 bytes (one for each ASCII character).
    I hope I have made myself clear.
    Attachments:
    U16 to Hex String.vi ‏8 KB

  • How to convert binary data to PDF and attach to the particular po

    our client wants to attach the pdf coming from portal as attachment to that particular PO. From portal the pdf will come in binary format. Find how will we convert that binary data back to pdf and attach to the PO in R/3?

    Hi,
    You can downlaod Binary data into PDF using GUI_DOWNLOAD...pass the binary data and the BINSIZE...
    santhosh

  • Convert Binary Data into Pdf & send it as attachment in a mail in Workflow

    Hi,
    Scenario:
    The interactive form saved in WebDynpro Application is sent to R/3 in binary format. It has to be converted into pdf and sent it as an attachment in mail to the respective person in workflow.
    Kindly help on these issues :
    1. How to receive the binary data in R/3 sent by the WebDynpro Application ?
    To my knowledge we can receive the binary in XSTRING data type. Plz correct me if am wrong.
    2. How do i convert the received binary data into pdf ?
    Thanks,
    Bharath Kaushik

    Hi Bharath,
    I think you should try to write dat being sent to R/3 to spool first, as in R/3 there is FM <i>CONVERT_ABAPSPOOLJOB_2_PDF</i> , with the help of which you will be able to convert Binary data to PDF format.
    Pls find one of the threads related to this , and see if this is useful to you.
    Problem in CONVERT_ABAPSPOOLJOB_2_PDF.
    Hope this atleast helps to start off.
    Regds,
    Akshay Bhagwat
    PS: Some points would be nice if it helps:)

  • Convert Binary Data into Pdf & send it as attachment in a mail

    Hi Friends,
    Scenario :
    The interactive form saved in WebDynpro Application is sent to R/3 in binary format. It has to be converted into pdf and sent it as an attachment in mail to the respective person.
    Kindly help on these issues :
    1. How to receive the binary data in R/3 sent by the WebDynpro Application ?
    2. How do i convert the received binary data into pdf ?
    Regards & Thanks,
    Bharath Kaushik Krishnan

    Check thread Data Conversion
    if it is useful for you.

  • Convert Binary Data into Pdf & send it as attachment in a mail from R/3

    Hi,
    Scenario:
    The interactive form saved in WebDynpro Application is sent to R/3 in binary format. It has to be converted into pdf and sent it as an attachment in mail to the respective person in workflow.
    Kindly help on these issues :
    1. How to receive the binary data in R/3 sent by the WebDynpro Application ?
    To my knowledge we can receive the binary in XSTRING data type. Plz correct me if am wrong.
    2. How do i convert the received binary data into pdf ?
    Thanks,
    Bharath Kaushik Krishnan

    HI Bharath,
    I think You can reuse teh XString for binary data.there are certain function modules in R/3 for creating pdf/for sending it as pdf attatchment.please search in abap forums you will find more information
    With Regards
    Naidu

  • Best way to put binary-data into string?

    Hi there!
    What I want to do is to transfer binary data via HTTP/GET so what I have to do is to transfer binary data into a string.
    Currently I do this the follwing way:
          byte[] rawSecData = new byte[4]; //any binary datas
          ByteArrayOutputStream secBOS = new ByteArrayOutputStream(4);
          DataOutputStream secDOS = new DataOutputStream(secBOS);
          for(int i=0; i < rawSecData.length; i++)
            secDOS.writeByte(rawSecData);
    secDOS.flush();
    String secData = secBOS.toString();
    System.err.println("Lenght of resulting String: "+secData.length());
    I know that this way already worked fine, however I now set up my system up again with another linux-distro and now strange things happen.
    e.g. the secData string differs in lenght from run-to-run between 2 and 4 and I don know at all why?
    Transferring the binary-stuff into string-stuff (e.g. short-binary 255 255, String: 65536) is not possible for me because of various reasons.
    The funny thing is that I remeber that this already worked some time ago and I can figure out why it now doesnt...
    Please help!

    First of all thanks a lot for your help!
    Yes, I already think its an encoding problem, but how can I specify the encoding in my application in a portable way. I dont have an idea what to do.
    My applikation should run as applet on many different 1.1+ VMS (msjvm, netscape-1.1.5, ...).
    Thanks again, lg Clemens

  • How to export image data into XDP

    Hi, All
      I'm working on a healthcare project that needs to export the doctor's signature image into XDP file from the database to fill in the Insurance company claim form. My question is how to export image data into a field node in the XDP file, we know the name of the image field which defined in the PDF form, Is it something like:
      the signature image data ?
    Should the image data in this node be base64 encoded or text encoded or something else?
    Can the image be any kind? e.g. BMP, PNG, JPEG, ..., etc?
    Thanks
    William

    Hi Andre,
    Document will be of ASCII characters right?? but image data will be in binary format. as per database concept it is stored as binary large object. But in datawarehousing the back end is also going to be some database such as Oracle or other DBs.
    which can take blob's. so it would be possible to store the binary data.
    If any one has faced this situation can reply.to this ques.
    can post the step to load image(jpg/bmp or any image format) data in to info cube??
    hi andre if u have done loading image data as you say.pls reply me if you have the steps with you.
    thanks Andre

  • How to load image data into cube?? Is it possible??

    How to load image data into cube?? Is it possible??
    Any sugession??

    Hi Andre,
    Document will be of ASCII characters right?? but image data will be in binary format. as per database concept it is stored as binary large object. But in datawarehousing the back end is also going to be some database such as Oracle or other DBs.
    which can take blob's. so it would be possible to store the binary data.
    If any one has faced this situation can reply.to this ques.
    can post the step to load image(jpg/bmp or any image format) data in to info cube??
    hi andre if u have done loading image data as you say.pls reply me if you have the steps with you.
    thanks Andre

  • Binary data into a XML

    Hello,
    I'd like to know how I could insert binary data into a XML message, for example, an image.
    Does XML Java API support binary data insertion into a XML message? Or should I make my own classes to do this?
    As I've read in the next url http://www.javaworld.com/javaworld/javatips/jw-javatip117.html ,
    the best approach is to use a Base-64 encoding. The encoding algorithm processes a byte stream in 3-byte sequences. Each 3-byte sequence parcels into four 6-bit data units. Each 6-bit data unit then encodes into the character stream as the corresponding character from the character set: A-Z, a-z, 0-9, +, and /.
    Thanks

    Does XML Java API support binary data insertion into a
    XML message? Or should I make my own classes to do
    this?The XML Java API's support producing well-formed XML according to the XML specifications. Those specifications do not say (or even suggest) how you should encode binary data to put it into XML. If you want to encode your binary data in some way then you are free to do so, but you'll have to write your own code.

  • How can I load data into table with SQL*LOADER

    how can I load data into table with SQL*LOADER
    when column data length more than 255 bytes?
    when column exceed 255 ,data can not be insert into table by SQL*LOADER
    CREATE TABLE A (
    A VARCHAR2 ( 10 ) ,
    B VARCHAR2 ( 10 ) ,
    C VARCHAR2 ( 10 ) ,
    E VARCHAR2 ( 2000 ) );
    control file:
    load data
    append into table A
    fields terminated by X'09'
    (A , B , C , E )
    SQL*LOADER command:
    sqlldr test/test control=A_ctl.txt data=A.xls log=b.log
    datafile:
    column E is more than 255bytes
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)

    Check this out.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1006961

  • Step- by- Step on How to Load Excel data into Crystal Reports?

    Hi Friends,
                      Can anyone send me a Step- by- Step on How to Load Excel data into Crystal Reports? Pls help me. Thanks in Advance.
    Vijay

    It's also important to 'prep' the excel file prior to connecting to it.
    Give the data tab a meaningful name
    Make sure the column headers are unique and that every column has a header
    Delete any blank tabs
    If you have trouble with Excel changing the data type of a field (say, a social security number you want to be a string value rather than a number so you don't lose leading zero) an alternative would be to save the spreadsheet file as a CSV, create a schema.ini to specify the data types for each column (example below) and use the same steps to connect except instead of choosing Excel 8.0, scroll to the bottom and choose Text.  You have to make sure the CSV file is in the same folder as the schema.ini file that defines the columns.
    Schema.ini example:
    200912PUSD.csv
    ColNameHeader=True
    Format=CSVDelimited
    MaxScanRows=25
    CharacterSet=OEM
    Col1=SSN Char Width 9
    Col2=LAST_NM Char Width 25
    Col3=FIRST_NM Char Width 25
    Col4=DOB Date
    Col5=STDNT_ID Char Width 10
    Col6=SORTKEY Char Width 10
    Col7=SCHOOL_NM Char Width 30
    Col8=OTHER_ID Integer
    Col9=GRADE Char Width 2
    The filename in the first line needs to have the []  brackets around it, but I couldn't get it to display in this forum correctly.
    Edited by: Eric Petersen on Jan 27, 2010 9:40 AM

  • How to populate the data into the newly added infoobjects?

    Hi,
    how to populate the data into the newly added infoobjects?
    Thanx in advance,
    Ravi.

    hi ravi,
      here is one example how to enhance.
    Goto RSA6- select the 0Material.- Click on Enhance extract structure-> it will take u to the next screen there u need to create the field material group1. and append it to 0Material.
    Goback to RSA6-- RC on 0material-- it will take you to customer version edit screen- here unchk the Hide and Field only known in exit options n save it.
    Next Go back to RSA6-- 0material- click on Function enhancement it will take you to CMOD Screen( here we need to enter the project name and click create if not created on click display)
    In the next screen we find the function exits Like EXIT_SAPLRSAP_001 FOR T DATA AND EXIT_SAPLRSAP_002 FRO Master Data,_003 for Text n _004 for Hierarchies.
    select the appropriate function exit and double clikc on it. It will take you to Function builder screen.
    D Click on defn of Include ZXRSAU01. it will take you to abap editor screen.
    here u need to include the code for the enhanced fields n also write the code to populate the dat for that particular field.
    save it and avtivate the code.
    Hope this Is helpz,
    partha

Maybe you are looking for