How to display the file contents???

Hi all,
I have a JSP page which is suppose to display resource contents on clicking of href like this:
<td><a href="">Click here</td>But the problem is, these contents are stored some where on the hard disk of the system inside the folder \\LMS\Resources\doc\knowledge.doc.
some other file I have like:
\\LMS\Resources\pdf\display.pdf
It can be any file (PDF,DOC,SOUND AUDIO).
Can anyone please tell me how to open the contents of the file directly from href???
Or I should use some other way to display those files.??I just want a way to start with.......
Thanks in advance
Namrata

Hello Namrata,
There are millions of ways to do this.
1. You can create a shared drive in your server as "\\LMS\Resources" pointing to K Drive etc... You can write a simple servlet which picks up the relative path from "\\LMS\Resources" which is "pdf\display.pdf" and it can read the file and then based on the file extension it can resend the response mime type for the browser to pick it up. This can be done in both Windows and Unix environments.
2. Have a Content Management System like Lotus Domino, Fatwire, etc and upload all contents and point the href to the Content Management System URL.
3. You can upload the documents into a database as BLOB data and then use it to render content.
4. You can also have a regular program which synchronizes the data from \\LMS into the Server hardware in a particular location.
In Options 1, 3, 4 you need the servlet to render the content out to the Client browser.
All this can be done based on the Technology environment, cost available to spend, Skill sets available and other factors.
Do let me know if you need any more information
Thanks,
Pazhanikanthan. P

Similar Messages

  • How to display the variable content in message?

    Hi anybody
    please let me know How to display the variable content in message?
    please send few lines of sample code to understand that
    thanks in advance

    Hi,
    Check out the link
    http://help.sap.com/saphelp_nw70/helpdata/en/2c/840b42202cce6ce10000000a155106/content.htm
    REPORT Y9020027 LINE-SIZE 130.    "Release 3.1G, 4.5A                  
    BREAK-POINT.
    MOVE: 'TESTREPORT for    "ASSIGN  FFeld+o(l)  TO  "        '     
            TO SY-TITLE.
          Declaration of variables    **********************
    FIELD-SYMBOLS <FS1>.
    DATA: FFELD8(8)   TYPE F VALUE '1022333'.   "Unusual: Explicit 8 bytes
    *DATA: ZFELD1(2)    TYPE N.            "Here slack bytes are (DW border)
                                         "necessary                      
                  "If you like computing error, please uncomment the above
    DATA: FFELDX(8)   TYPE F VALUE '7777777'.
    DATA: FFELDA(8)   TYPE F VALUE '7333213'.
    DATA: NFELDX(400) TYPE N.
    DATA: OFFX(4) TYPE I VALUE 160.
    DATA: LENX(4) TYPE I VALUE 8.
                  Main Section             *******************
        SKIP.
        WRITE: /5  'Example 1   **** inadmissible ASSIGN ***' COLOR 6.
        WRITE: /10 'Inadmissible ASSIGN: ''ASSIGN FFELD4+1(3) TO <FS1>'' '.
      ASSIGN FFELD4+1(3) TO <FS1>.
        ULINE.
        SKIP 2.
        SKIP.
    ASSIGN FFELD8+8(8) TO <FS1>.     "<-- Assigning of variable  FFELDX  !!
        BREAK-POINT.
        WRITE: / 'ASSIGN command with FFELD8, but FFELDX will be assigned'
                  COLOR 3.
        WRITE: /5 'Example 2'.
        PERFORM DISPLAY-FFELD USING FFELD8 'FFELD8'.
        WRITE: /10 'Content of   FFELDX      :', FFELDX.
        ULINE. SKIP 2.
        SKIP.
    ASSIGN FFELD8+16(8) TO <FS1>.    "<-- Assiging a few FFELDA to <FS1>  
        BREAK-POINT.
        WRITE: / 'ASSIGN with FFELD8, but instead FFELDA is assigned'
                  COLOR 3.
        WRITE: /5 'Example 3'.
        WRITE: /10 'Content of   FFELDA      :', FFELDA.
        PERFORM DISPLAY-FFELD USING FFELD8 'FFELD8'.
        WRITE: /10 'Content of   FFELDA      :', FFELDA.
        ULINE. SKIP 2.
    BREAK-POINT.
       DO 4 TIMES.
         ASSIGN FFELD8+OFFX(LENX) TO <FS1>.     "Zuordnung auf OFFX zu <FS1>
            WRITE: / 'ASSIGN command with FFELD8, es wird NFELDX zugeordnet'
                      COLOR 5.
             WRITE: /5 'Example 4', 'DO-Schleife Nr.:', SY-INDEX.
             PERFORM DISPLAY-FFELD USING FFELD8 'FFELD8'.
             WRITE: /10 'Content of NFELDX145(40)  :', NFELDX145(40).
             ULINE. SKIP 2.
             ADD 8 TO OFFX.
       ENDDO.
                   Subroutines             *******************
               Display of data fields and field symbols                  *
    FORM DISPLAY-FFELD USING FFELD FNAME.
    WRITE: /10 'Content of', FNAME, ':', FFELD.
    PERFORM FELDEIGENSCHAFTEN USING FFELD.
    WRITE: /10 'Content of <FS1> :', <FS1>.
    PERFORM FELDEIGENSCHAFTEN USING <FS1>.
    ADD   111    TO <FS1>.               "<-- Das Feldsybmol wird verwendet
    WRITE: /10 'ADD 111 TO <FS1>'.
    ULINE.
    WRITE: /10 'Content of', FNAME, 35 ':', FFELD.
    WRITE: /10 'Content of <FS1>',  35 ':', <FS1>.
    ENDFORM.
       Determination of field properties (only for information)          *
    FORM FELDEIGENSCHAFTEN USING ALLG.
    DATA: FLAENGE(2) TYPE N.
    DATA: FTYP(1) TYPE C.
    DATA: FOUT(2) TYPE N.
    DATA: FDEZ(2) TYPE N.
      ULINE.
      DESCRIBE FIELD ALLG LENGTH FLAENGE.
      WRITE: /10 'Field length  :', FLAENGE.
      DESCRIBE FIELD ALLG TYPE FTYP.
      WRITE: /10 'Field type    :', FTYP.
      DESCRIBE FIELD ALLG OUTPUT-LENGTH FOUT.
      WRITE: /10 'Output length :', FOUT.
      DESCRIBE FIELD ALLG DECIMALS FDEZ.
      WRITE: /10 'Decimals      :', FDEZ.
      SKIP 1.
    ENDFORM.
    END OF PROGRAM *************************************

  • How to display the file status in the status bar?

    Hi all,
    Can anyone tell me how to display the file status in the status bar?
    The file status can consists: the type of the file, the size of the file etc..
    thanx alot..

        class StatusBar extends JComponent {
              JLabel l = new JLabel("ready");
            public StatusBar() {
                  super();
                  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
                  add(l);
              public void setText( String prompt ) {
                   l.setText(prompt);
                   setVisible( true );
            public void paint(Graphics g) {
                  super.paint(g);
        }

  • How to display the same content in the two different main windows?

    Hi experts,
    How to display the same content in the two different main windows?
    Thanks in advance.
    sarath

    Hi
    Sorry but you can't have two main windows in sapscripts.
    Regards
    Gregory

  • How to send the file contents in the application server to ftp server

    Hi,
    how to send the file contents in the application server to ftp server.
    regards,
    sree

    Test SAP FTP functions
    DATA: BEGIN OF MTAB_DATA OCCURS 0,
    LINE(132) TYPE C,
    END OF MTAB_DATA.
    DATA: MC_PASSWORD(20) TYPE C,
    MI_KEY TYPE I VALUE 26101957,
    MI_PWD_LEN TYPE I,
    MI_HANDLE TYPE I.
    START-OF-SELECTION.
    MC_PASSWORD = 'password'.
    DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
    *-- FTP_CONNECT requires an encrypted password to work
    CALL 'AB_RFC_X_SCRAMBLE_STRING'
         ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
         ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
         ID 'DSTLEN' FIELD MI_PWD_LEN.
    CALL FUNCTION 'FTP_CONNECT'
         EXPORTING
           USER            = 'userid'
           PASSWORD        = MC_PASSWORD
           HOST            = 'servername'
           RFC_DESTINATION = 'SAPFTP'
         IMPORTING
           HANDLE          = MI_HANDLE
         EXCEPTIONS
           NOT_CONNECTED   = 1
           OTHERS          = 2.
    CHECK SY-SUBRC = 0.
    CALL FUNCTION 'FTP_COMMAND'
         EXPORTING
           HANDLE = MI_HANDLE
           COMMAND = 'dir'
         TABLES
           DATA = MTAB_DATA
         EXCEPTIONS
           TCPIP_ERROR = 1
           COMMAND_ERROR = 2
           DATA_ERROR = 3
           OTHERS = 4.
    IF SY-SUBRC = 0.
      LOOP AT MTAB_DATA.
        WRITE: / MTAB_DATA.
      ENDLOOP.
    ELSE.
    do some error checking.
    ENDIF.
    CALL FUNCTION 'FTP_DISCONNECT'
         EXPORTING
           HANDLE = MI_HANDLE
         EXCEPTIONS
           OTHERS = 1.
    Execute external commands (FTP Scripts)
    The following code shows the syntax of the FM 'SXPG_COMMAND_EXECUTE'. You pass it the external command created within transaction SM69 and it will execute it.
    DATA: ld_comline 
    LIKE sxpgcolist-name,
            ld_param    LIKE sxpgcolist-parameters,
            ld_status   LIKE extcmdexex-status,
            ld_output   LIKE btcxpm OCCURS 0 WITH HEADER LINE,
            ld_subrc    LIKE sy-subrc.
      REFRESH ld_output.
      MOVE 'FTP_DATA_IN' to ld_comline.         "Maintained using trans SM69
    Execute external command, contained in 'ld_comline'
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
           EXPORTING
                commandname                   = ld_comline
              additional_parameters   = ld_param  "Params passed to script
              operatingsystem              
    = 'UNIX'
           IMPORTING
                status                        = ld_status
           TABLES
                exec_protocol                 = ld_output
           EXCEPTIONS
                no_permission
                     = 1
                command_not_found
                 = 2
                parameters_too_long          
    = 3
                security_risk                
    = 4
                wrong_check_call_interface    = 5
                program_start_error           = 6
                program_termination_error     = 7
                x_error                       = 8
                parameter_expected            = 9
                too_many_parameters           = 10
                illegal_command               = 11
                wrong_asynchronous_parameters = 12
                cant_enq_tbtco_entry
              = 13
                jobcount_generation_error
         = 14
                OTHERS                       
    = 15.
      IF sy-subrc NE 0.
      ENDIF.

  • How to view the file content from the directory? getting Error:ORA-21560

    SQL> create directory READ_LOB_DIR as 'D:\Prj\Comm\Data';
    CREATE OR REPLACE Procedure READ_FILE_LOB IS
    -- Input Directory as specified in create directory
    l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
    -- Input File which is read word by word
    l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
    -- Separator Character between words is a BLANK (ascii = 32)
    l_seb CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(32));
    -- Character at the end of the file is NEWLINE (ascii = 10)
    l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
    -- Pointer to the BFILE
    l_loc BFILE;
    -- Current position in the file (file begins at position 1)
    l_pos NUMBER := 1;
    -- Amount of characters have been read
    l_sum BINARY_INTEGER := 0;
    -- Read Buffer
    l_buf VARCHAR2(500);
    -- End of the current word which will be read
    l_end NUMBER;
    -- Return value
    l_ret BOOLEAN := FALSE;
    BEGIN
    -- Mapping the physical file with the pointer to the BFILE
    l_loc := BFILENAME(l_dir, l_fil);
    -- Check if the file exists
    l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
    IF (l_ret) THEN
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' exists');
    -- Open the file in READ_ONLY mode
    DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
    LOOP
    -- Calculate the end of the current word
    l_end := DBMS_LOB.INSTR(l_loc, l_seb, l_pos, 1);
    -- Process end-of-file
    IF (l_end = 0) THEN
    l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
    l_sum := l_end - l_pos - 1;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    EXIT;
    END IF;
    -- Read until end-of-file
    l_sum := l_end - l_pos;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    l_pos := l_pos + l_sum + 1;
    END LOOP;
    DBMS_LOB.CLOSE(l_loc);
    ELSE
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' does not exist');
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error:' || SQLERRM);
    DBMS_LOB.CLOSE(l_loc);
    END;
    The Text file content is...
    Copyright 1996,2001 Oracle Corporation.     All Rights Reserved
    This file contains installation instructions for installing the
    Oracle8 ODBC Driver software.
    It is divided into four parts:
    o Part I: Summary of systems supported by Oracle8 ODBC client
    software
    Lists the platforms on which the Oracle8 ODBC Client software can
    be installed.
    o Part II: Oracle8 ODBC Driver software.
    Describes the files, and installation prerequisites for the Oracle8
    ODBC driver software.
    o Part III: Exploding the kit onto your system
    Describes how to explode the kit onto your system hard drive.
    o Part IV: Installation Instructions
    Describes how to install the Oracle8 ODBC driver.
    Part I: Systems supported by the Oracle8 client software
    You can install the ODBC client software on any of the following systems:
    o Windows 2000
    o Windows NT X86
    o Windows 95
    o Windows 98
    The Oracle8 ODBC Driver provides support for ODBC connections
    from Windows 2000, Windows NT, Windows 95, and Windows 98 systems
    to Oracle databases.
    o Part II: Oracle8 ODBC Driver software.
    Refer to the following files for information about the Oracle8 ODBC Driver:
    LICENSE.TXT - Oracle8 ODBC Driver License Agreement. Read carefully
    before installing and/or using this product. Enclosed in
    your software distribution kit.
    SQORA.HLP - A Window's Help file which is the primary reference
              manual for the Oracle8 ODBC Driver.
    ODBCRelnotes.WRI - The release notes for the Oracle8 ODBC Driver
    which contains information which may have not been
    included in the Help file.
    Installation Prerequisites
    See the Oracle8 ODBC Driver release notes (ODBCRelnotes.WRI),
    for a complete list of software products required and their versions.
    Time Required
    The installation of the Oracle8 ODBC Driver takes approximately 5
    minutes. The actual time may be shorter or longer, depending upon
    your hardware configuration.
    Disk Space Required
    The Oracle8 ODBC driver installation requires approximately 2
    megabytes of available storage space. The space required depends upon
    what files you already have installed. The installation procedure
    checks to see if you have enough available disk space. If you do not,
    the installation fails.
    Part III: Exploding the Kit onto your system
    Expand the self-extracting archive file onto your hard drive.
    C:\> ORA8174.EXE
    Part IV: Installation Instructions
    Oracle8 ODBC Driver 8.1.7.4.0
    This section assumes the following:
    1. MS Windows 2000, Windows NT, Windows 95 or Windows 98 is running.
    2. Oracle Universal Installer shipping with 8.1.7 has already been
    installed on your system.
    3. Part III has been completed.
    Software fixes:
    Refer to release notes (ODBCRelnotes.wri) for a complete list of
    Software fixes.
    Installation Instructions
    Once the self-extracting archive file ORA8174.EXE has been
    exploded it will create an installable directory structure
    onto your hard drive. Run the Oracle Universal Installer from
    your local drive.
    1. On the screen "File Locations" use the "Browse" button of
    the source path to choose the file 'products.jar' from the
    folder that ORA8174.EXE was extracted to. Choose 'Next'.
    2. You will receive a warning that some of the dependencies of
    this product are not found in the staging area. This warning
    is OK. The ODBC driver depends on the Net8 Client being already
    installed on the system. Answer 'Yes' to continue.
    Oracle is a registered trademark of Oracle Corporation.
    Microsoft, MS are registered trademarks of Microsoft Corporation.
    Microsoft Windows, Windows NT, Windows 95, Windows 98 and Open Database
    Connectivity are trademarks of Microsoft Corporation.
    All other trademarks and registered trademarks are the property
    of their respective owners.
    The output was...
    File testfile.txt in Directory READ_LOB_DIR exists
    Copyright
    1996,2001
    Oracle
    Corporation.     
    All
    Rights
    Reserved
    This
    file
    contains
    installation
    instructions
    for
    installing
    the
    Oracle8
    ODBC
    Driver
    software.
    It
    is
    divided
    into
    four
    parts:
    o
    Part
    I:
    Summary
    of
    systems
    supported
    by
    Oracle8
    ODBC
    client
    Error:ORA-21560: argument 2 is null, invalid, or out of range
    I want to diplay/view as per file content format from the file under that specified directory.
    Have any other method / any help or suggestions would be really appreciated.

    I changed the code like...
    CREATE OR REPLACE Procedure READ_FILE_LOB_tmp IS
    -- Input Directory as specified in create directory
    l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
    -- Input File which is read word by word
    l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
    -- Separator Character between words is a BLANK (ascii = 32)
    l_seb CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(32));
    -- Character at the end of the file is NEWLINE (ascii = 10)
    l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
    -- Pointer to the BFILE
    l_loc BFILE;
    -- Current position in the file (file begins at position 1)
    l_pos NUMBER := 1;
    -- Amount of characters have been read
    l_sum BINARY_INTEGER := 0;
    -- Read Buffer
    l_buf VARCHAR2(4000);
    -- End of the current word which will be read
    l_end NUMBER;
    -- Return value
    l_ret BOOLEAN := FALSE;
    BEGIN
    -- Mapping the physical file with the pointer to the BFILE
    l_loc := BFILENAME(l_dir, l_fil);
    -- Check if the file exists
    l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
    IF (l_ret) THEN
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' exists');
    -- Open the file in READ_ONLY mode
    DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
    LOOP
    -- Calculate the end of the current word
    l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
    -- Process end-of-file
    IF (l_end = 0) THEN
    EXIT;
    END IF;
    -- Read until end-of-file
    l_sum := l_end - l_pos;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    l_pos := l_pos + l_sum + 1;
    END LOOP;
    DBMS_LOB.CLOSE(l_loc);
    ELSE
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' does not exist');
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error:' || SQLERRM);
    DBMS_LOB.CLOSE(l_loc);
    END;
    Now its working fine with one addtional line...
    The file content is...
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    But The output was...
    File testfile.txt in Directory READ_LOB_DIR exists
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    here, i want to delete that additonal line...?

  • How to display a file content in view

    hi team,
    I have files which are already uploaded in SAP. I can read the contents of the file but
    I can't find the UI element where I can display the content of the file.
    I have heard that IFrame can be used to solve the purpose. But using IFrame I am only
    capable to show files which are in MIME objects.
    Can anybody give suggestions how to achieve it?

    Hi,
    have you tried
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/9d/a6884121a41c09e10000000a155106/frameset.htm">TextView</a> or <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/3b/219141c1d0ae5fe10000000a1550b0/frameset.htm">FormattedTextView</a> ?
    You could also make a development request.
    Regards, Heidi

  • How to display the xml content into my datagrid

    Hi Experts,
                     i have created a webservice for sales quotation through DI-Server.iam able to add a new sales quotation through my coding & iam able to get the sales quotation based on the DOcEntry in an *XML file*.
              The xml file that i got using DOCENTRY is in this way:--
    <?xml version="1.0" encoding="utf-8" ?>
    - <BOM>
    - <BO>
    - <AdmInfo>
      <Object>oRecordset</Object>
      </AdmInfo>
    - <OQUT>
    - <row>
      <DocEntry>8</DocEntry>
      <DocNum>8</DocNum>
      <DocDate>20080715</DocDate>
      <DocDueDate>20080815</DocDueDate>
      <CardCode>C0003</CardCode>
      <CardName>HP India</CardName>
      <DocTotal>14500.000000</DocTotal>
      <ItemCode>A00006</ItemCode>
      <Dscription>HP Officejet 7310 All-in-One</Dscription>
      <Quantity>1.000000</Quantity>
       <Price>14500.000000</Price>
      <Currency>INR</Currency>
       <DiscPrcnt>10.000000</DiscPrcnt>
      <LineTotal>14500.000000</LineTotal>
       </row>
      </OQUT>
      </BO>
      </BOM>
    Now the problem is from this xml content i should display the values in my datagrid like:
    DocEntryCardCodeDocDueDateItemCodeDscriptionQtyTotal
         8--C000320081116--A00006-HP-off jet-2 ---                     1000
    can anybody suggest me some ideas that how to get the SPECIFIED values into my datagrid...........
    regards,
    shangai.

    hi vincent,
                    Thanks for your reply.iam unable to understand these lines in your code..iam working in vb.net
    public static DataSet GetDataSetFromXML(XmlNode XMLNode)
    grid.DataSource = GetDataSetFromXML(Result.SelectSingleNode(xpath_string));
    this is my coding....it's throwing an error when i declare like this
    Public Sub GetDataSetFromXML(ByVal XmlNode)
            Dim ds As New DataSet
            Dim reader As XmlNodeReader
            reader = New XmlNodeReader(XmlNode)
            ds.ReadXml(reader)
            reader.Close()
            'Return ds --->(error with syntax)
        End Sub
    DataGrid1.DataSource = GetDataSetFromXML(oXmlReply.SelectSingleNode("//DocDueDate"))
                DataGrid1.DataBind()
    regards,
    shangai

  • How to get the file content after uploading file

    Hello everyone!
    I have a question. Anyone can provide an example code by jsp that getting the uploaded file content after user uploading a file?
    Your help is highly appreciated!!!

    My experience is you need to do it twice: first read it to a StringBuffer and readline. Then write the file to server. See the code below
    MultipartParser parser = new MultipartParser(request, 10000000);
    Part part = null;
    FilePart filePart = null;
    File uploadDir = new File("/Uploads/");
    if (!uploadDir.exists()) {
    uploadDir.mkdir();
    while(true){
         part = parser.readNextPart();
         if(part == null)
              break;
         if(part instanceof FilePart){
              filePart = (FilePart)part;
              filename = filePart.getFilePath();
              //You can do one of the following option. Here is read line to a buffer and display to screen
    //if (filename != null) {
              //Do not store the file to server machine.
    //long size = filePart.writeTo(uploadDir);
    // System.out.println("The number of bytes written is "+size);
              reader = new BufferedReader(new InputStreamReader(filePart.getInputStream()));          
              String newline=reader.readLine();
              if(newline!=null)     {     
              reconcileContent.append("<table border=\"1\"><tr><th>Destination ID</th><th>File ID</th><th>Rept Date</th><th>As of Date</th><th

  • How to display the file name & status when copying files.

    I write a program to backup/copy data from one directory to other directory, and I'm using File List and Runtime.getRuntime().exec("xcopy "+dir1+"\\"+name+" "+dir2+" /y");
    to copy the files, so it will copy the file one by one, and everytime one file is copied, I want to display the result to the screen, but guess what has happened, the screen just display a blank screen, and wait until all the copying processes finish, then it will display all files that has been copied.
    Appreciate your expertise to check my coding below.
    String[] fileList = fbackupSource.list();
    boolean done=true;
    JTextArea backupText = new JTextArea();
    JScrollPane backupScroll = new JScrollPane(backupText,
    ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
    ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    JFrame backupWindow = new JFrame("Backup Data");
    backupWindow.setBounds(320,240,400,330);
    backupWindow.getContentPane().add(backupScroll);          
    backupText.setText("Copy files from "+backupSource.toUpperCase()+" to "+backupDest.toUpperCase()+" : \n\n");
    backupWindow.show();
    for (int i=0; i < fileList.length; i++) {                     
    backupText.append(" ("+ i +")... processing " + fileList);
    done = copyFile(fileList[i],backupSource,backupDest);
    if (done=true) {
    backupText.append(" -> done. \n");
    else {
    backupText.append(" -> fail! \n");
    boolean copyFile(String name, String dir1, String dir2) {
    try {
    java.lang.Process proc =
    Runtime.getRuntime().exec("xcopy "+dir1+"\\"+name+" "+dir2+" /y");
    proc.waitFor();
    return true;
    catch (IOException e) {
    return false;
    catch (InterruptedException e) {
    return false;

    Oops, sorry, I should have written "Process.getInputStream()". Here's an example from:
    http://javafaq.nu/tips/opsys/index.shtml
    ==============
    How can I pass a string to the command line(DOS) ? Also i want to capture the output given by the command line in a string.
    Answer: Try this out:
    // works for DOS
    String cmds[] = new String[2];
    cmds[0] = "dir"; // replace with "ls" on UNIX
    cmds[1] = "c:"; // replace with "/" on UNIX
    // execute the command
    Process pro = Runtime.getRuntime().exec(cmds);
    // wait until it's done executing
    pro.waitFor();
    // what did the process output from the Input pipe back to
    // this process (okay, who named this stuff)?
    InputStream out = pro.getInputStream();
    // output it (really slowly)
    int i;
    while ((i = out.read()) != -1) System.out.println((char) i);==============
    Although I don't think this example will do exactly what you want... you might have to delete the waitFor() call and just check to see when there's nothing else to read from the InputStream. It's a start, though, and the web page has a lot of similar examples of this sort of thing.
    Yours,
    Tom

  • How to show the file contents in a streaming manner on the browser

    Hi,
    I have a log file which gets appended to by another program.
    I need to show the contents of this log file in the browser window but in a streaming manner. Reading the file in one shot and refreshing the page every few seconds is not a solution as it makes the browser hang when the file size is huge. A unix tail functionality is also acceptable but it should be streaming. Would a servlet or applet do the trick?
    Please advise!

    is your log file present on web/application server? if yes, you can do the following:
    1. create a web page containing text area. (for displaying log file)
    2. use XmlHttpRequstObject (Ajax) for querying the next available data from Servlet.
    On the Serverside:
    You can store the the FileScanner object in session scope. and use it to read the next available data and send it as response.
    On the client Side(webpage/javascript)
    read the contents of the response and append it to textarea.
    In Simple words, I'd say AJAX is the way to go.

  • How to download a file/contents through a session bean to the bean client

    Hi All,
    I'm a newbie to enterprise beans and facing a problem. I have a requirement where an excel file saved on the server will be a accessed by a session bean and return it to the bean client (developed in swing). Client will display the file contents, user edits the contents and saves. Pressing the save button will save the excel on the server again using the same session bean.
    As far as displaying the contents of excel on the form/panel is concerned I have developed this part and able to load files and save them on my local machine.
    But my main requirement is to load it through Session Bean and then save it back on the server. An EJB 2.0 code snippet addressing this part would be a great help.
    Thanks,

    and where's the problem?
    I see 2 EJB calls, one to retrieve the data and another one to send it back to the server.
    That's the simplest scenario, easy to implement using a stateless session bean (though if you want to prevent concurrent modification of the file there's a bit more work to do, like keeping a record of open files).
    A more complex solution would have the client send only the changes to the file (for network performance reasons maybe) and have the EJB merge those in some way with the original document.
    Complex, possibly error prone, probably not worth the effort.
    First scenario should pose no problem if you're familiar with Java and have a passing familiarity with EJB.

  • How to display text file in  swing

    hello,
    I have screen where user enters batch number and number.
    when key is pressed a list is displayed on the screen.how to do this and how to relate my actionlistener with the function that generates the list...

    Hi,
    It is simple. Just create a button and add it to the action listener as button.addActionListener(this);
    Your class should extend ActionListener. and also there should be a method named - actionPerformed(ActionEvent avt) in your class
    Now inside this method, just compare the action as:
    if(avt.getSource()==button)
    // in this method, hjust take your file contents and display it on the same window, or create a new Frame here and display it in that window.
    If you want to display the file contents in the same window, then do the following.
    Declare a public JLabel variable for the class and create the JLabel along with the other components as usual but without giving any values. Now in the action part of the button, read the file contents in a string variable, and set the string to the jlabel as folows:
    label.setText(string);
    Hope it helps,
    Cochu.

  • How to write the JTables Content into the CSV File.

    Hi Friends
    I managed to write the Database records into the CSV Files. Now i would like to add the JTables contend into the CSV Files.
    I just add the Code which Used to write the Database records into the CSV Files.
    void exportApi()throws Exception
              try
                   PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
                   System.out.println("Connected");
                   stexport=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
                   rsexport=stexport.executeQuery("Select * from IssuedBook ");
                   ResultSetMetaData md = rsexport.getMetaData();
                   int columns = md.getColumnCount();
                   String fieldNames[]={"No","Name","Author","Date","Id","Issued","Return"};
                   //write fields names
                   String rec = "";
                   for (int i=0; i < fieldNames.length; i++)
                        rec +='\"'+fieldNames[i]+'\"';
                        rec+=",";
                   if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
                   writing.println(rec);
                   //write values from result set to file
                    rsexport.beforeFirst();
                   while(rsexport.next())
                        rec = "";
                         for (int i=1; i < (columns+1); i++)
                             try
                                    rec +="\""+rsexport.getString(i)+"\",";
                                    rec +="\""+rsexport.getInt(i)+"\",";
                             catch(SQLException sqle)
                                  // I would add this System.out.println("Exception in retrieval in for loop:\n"+sqle);
                         if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
                        writing.println(rec);
                   writing.close();
         }With this Same code how to Write the JTable content into the CSV Files.
    Please tell me how to implement this.
    Thank you for your Service
    Jofin

    Hi Friends
    I just modified my code and tried according to your suggestion. But here it does not print the records inside CSV File. But when i use ResultSet it prints the Records inside the CSV. Now i want to Display only the JTable content.
    I am posting my code here. Please run this code and find the Report.csv file in your current Directory. and please help me to come out of this Problem.
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.table.*;
    public class Exporting extends JDialog implements ActionListener
         private JRadioButton rby,rbn,rbr,rbnore,rbnorest;
         private ButtonGroup bg;
         private JPanel exportpanel;
         private JButton btnExpots;
         FileReader reading=null;
         FileWriter writing=null;
         JTable table;
         JScrollPane scroll;
         public Exporting()throws Exception
              setSize(550,450);
              setTitle("Export Results");
              this.setLocation(100,100);
              String Heading[]={"BOOK ID","NAME","AUTHOR","PRICE"};
              String records[][]={{"B0201","JAVA PROGRAMING","JAMES","1234.00"},
                               {"B0202","SERVLET PROGRAMING","GOSLIN","1425.00"},
                               {"B0203","PHP DEVELOPMENT","SUNITHA","123"},
                               {"B0204","PRIAM","SELVI","1354"},
                               {"B0205","JAVA PROGRAMING","JAMES","1234.00"},
                               {"B0206","SERVLET PROGRAMING","GOSLIN","1425.00"},
                               {"B0207","PHP DEVELOPMENT","SUNITHA","123"},
                               {"B0208","PRIAM","SELVI","1354"}};
              btnExpots= new JButton("Export");
              btnExpots.addActionListener(this);
              btnExpots.setBounds(140,200,60,25);
              table = new JTable();
              scroll=new JScrollPane(table);
              ((DefaultTableModel)table.getModel()).setDataVector(records,Heading);
              System.out.println(table.getModel());
              exportpanel= new JPanel();
              exportpanel.add(btnExpots,BorderLayout.SOUTH);
              exportpanel.add(scroll);
              getContentPane().add(exportpanel);
              setVisible(true);
          public void actionPerformed(ActionEvent ae)
              Object obj=ae.getSource();
              try {
              PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
              if(obj==btnExpots)
                   for(int row=0;row<table.getRowCount();++row)
                             for(int col=0;col<table.getColumnCount();++col)
                                  Object ob=table.getValueAt(row,col);
                                  //exportApi(ob);
                                  System.out.println(ob);
                                  System.out.println("Connected");
                                  String fieldNames[]={"BOOK ID","NAME","AUTHOR","PRICE"};
                                  String rec = "";
                                  for (int i=0; i <fieldNames.length; i++)
                                       rec +='\"'+fieldNames[i]+'\"';
                                       rec+=",";
                                  if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
                                  writing.println(rec);
                                  //write values from result set to file
                                   rec +="\""+ob+"\",";     
                                   if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
                                   writing.println(rec);
                                   writing.close();
         catch(Exception ex)
              ex.printStackTrace();
         public static void main(String arg[]) throws Exception
              Exporting ex= new Exporting();
    }Could anyone Please modify my code and help me out.
    Thank you for your service
    Cheers
    Jofin

  • How to display the content of a region on a different page

    Hello,
    Does anyone knows how to display the content of a region on an other page. I try to make page that displays content that resides somewhere else in my portal, so I can give a summarization of some hot topics. I really want to display the whole content of some regions (not a display with custom search).
    Thanks a lot,
    Hans

    Set that page as portlet, include it in a region in another page and in the edit defaults decide which regions you want to display.
    Mere.

Maybe you are looking for

  • Request timed out because there has been no reply from the server

    Hi, I am using "Embedded report application server 11.5". When i am going to launch report with the help of above mentioned server i am getting "Request timed out because there has been no reply from the server for more than 600,000 milliseconds" err

  • Queue Name in  XI

    Hi All, I have a simple scenario: JMS --> XI --> SAP R/3 (file adapter). The sender adapter have e QoS = EO. The message is splitted in two interfaces in order to apply two different mappings for the same sent message. I have noted in the trace of th

  • Changing iTunes library that iPhoto looks for

    Hello all... I have the same problem that others have posted about but with a bit of a twist. When I go to add iTunes music to my slideshow, it says to "open iTunes 6 or later to populate this list." I have tried the suggested Apple solutions but I t

  • Two BW systems connecting to an OLTP system

    We are upgrading our BW systems(3.5) to  BI 7.0. We are planning for a parallel Break-fix path. so we made a copy of our BW dev system(BWS) BWS-BWQ-BWP BWS2-BWQ2 BWS2 is a copy of BWS and plan to upgrade it to BI 7.0 .we plan to retire BWS after upgr

  • "Show Package Content" organization ... or lack thereof.

    I have been using iPhoto on and off again since 2004. Over the years we have updated our computer various times, so the pictures have been constantly moved around from iPhoto '04 to '06 to '08 to'09. My husband has also 'backed up' my photos by dropp