Servlet for downloading a file

i am writing a servlet for downloading a file on a GET action in the form..the web-xml is deployed correctly as far as i can interpret..bt i am encountering an error during the run time..
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
here is the log file..
Jul 11, 2008 12:07:14 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet DwnFile threw exception
java.lang.NullPointerException
     at com.example.web.dwnfile.doGet(dwnfile.java:17)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
it has some more content bt it is just the exceptions thrwn...
and here is my *.java file*
package com.example.web;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class dwnfile extends HttpServlet
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
response.setContentType("/image/jpeg");
ServletContext ctx=getServletContext();
InputStream is=ctx.getResourceAsStream("/2004.jpeg");
int read=0;
byte[] bytes=new byte[1024];
OutputStream os=response.getOutputStream();
while ((read=is.read(bytes))!=-1)
{os.write(bytes,0,read);
os.flush();
os.close();
the bold line is whre the exception is pointing..i think..
thanks in advance..
Edited by: Sun_Rockz on Jul 10, 2008 7:13 PM

response.setContentType("/image/jpeg");
ServletContext ctx=getServletContext();
InputStream is=ctx.getResourceAsStream("/2004.jpeg");there was an error in this part of code..the image extension of .jpeg is not allowed it seems..on changing it to jpg worked..and
in the first line the contenttype mst not be preceded by a forward slash..
now one more doubt relating to the same servlet..
response.setContentType("application/x-zip");
ServletContext ctx=getServletContext();
InputStream is=ctx.getResourceAsStream("/servlet_spec.zip");
if i keep this in my servlet the required action is taking place..i.e.i am gettin a download option bt the problem is tht the file is getting downloaded as a download.do file.....
download.do is the url pattern tht i am using in my html web page..
i tried replacing different types of allplications and files bt all are downloaded wit the same name. i.e. download.do
so what do u think is reason behind this..
thanks for all the replies.
Edited by: Sun_Rockz on Jul 11, 2008 10:47 AM
Edited by: Sun_Rockz on Jul 11, 2008 10:51 AM

Similar Messages

  • Is there a way I can 'select all' for downloading purchase files via family sharing instead of selecting each file or folder one at a time?

    Is there a way I can 'select all' for downloading purchase files via family sharing instead of selecting each file or folder one at a time?

    or home sharing

  • How to log in background and execute a function for downloading a file

    Hello,
    i have a problem.
    I have an application with logon functionality. Over the application there is function to create a xml file for downloading it to the pc.
    Now i want to download this file in background and save it to a server.
    My problem is here how can i do this. The main problem is how to logon with the userid and password in background and how to dowload the file.
    Thanks,
    Regards,
    Ronald

    hi Ps ,
    Can you please do small sample ,
    that would help me in clear understanding
    thanks in advance
    ashok.c

  • Suitable browser for downloading Rapidshare files ...

    I use N91 mobile.
    I'm not in position to download Rapidshare files. I've enabled Java script in installed (part of firmware) browser, but whenever I try to download rapidshare files, it gives error message stating that 'enable Java script'. I do not know what to do?
    I tried other browsers like Opera (v8.65), JB,Ucweb, but no success.In all such browsers, I've enabled Javascripts. But same error message is coming.
    Can you comment - what might be problem? what are other browsers? can you download on your mobile Rapidshare files?
    Thanks for your support.
    Atul Kaji

    I cannot tell about it clearly but AFAIK only the integrated modded opera browser for N91 and separately available Opera MINI and Opera are availble for browsing.

  • Help for download local file

    Hi!!!
    This is my first post. Thanks to all the people here before all.
    I have a big problem trying to download a local file to an internal table. I have lines with more than 8000 positions, and i've tried to use WS_UPLOAD, GUI_UPLOAD and SO_OBJECT_UPLOAD, but all of them show me this messages:
       - Unable to satisfy send request: 8001 bytes.
    ¿Do you know any function module (i think it could be OO) that allows me to load this file?
    Thanks for all. Bye!

    Hi
    REPORT ZDOWN_UP_LOAD
            NO STANDARD PAGE HEADING
            LINE-SIZE  255.
    Declare Database Objects
    tables:
       DOKIL,
       TRDIR.
    Constants
    CONSTANTS:
       MC_TRDIR_IDENTIFIER(72)  TYPE C VALUE '%&%& RDIR',
       MC_REPORT_IDENTIFIER(72) TYPE C VALUE '%&%& REPO',
       MC_TEXT_IDENTIFIER(72)   TYPE C VALUE '%&%& TEXP',
       MC_THEAD_IDENTIFIER(72)  TYPE C VALUE '%&%& HEAD',
       MC_DOC_IDENTIFIER(72)    TYPE C VALUE '%&%& DOKL',
       MC_TRDIR_SHORT(4)        TYPE C VALUE 'RDIR',
       MC_REPORT_SHORT(4)       TYPE C VALUE 'REPO',
       MC_TEXT_SHORT(4)         TYPE C VALUE 'TEXP',
       MC_THEAD_SHORT(4)        TYPE C VALUE 'HEAD',
       MC_DOC_SHORT(4)          TYPE C VALUE 'DOKP'.
    Declare Module level data structures
    DATA: BEGIN OF MTAB_PROGRAM_SOURCE OCCURS 0,
             LINE(72) TYPE C,
           END OF MTAB_PROGRAM_SOURCE.
    DATA: MTAB_PROGRAM_TRDIR LIKE TRDIR OCCURS 0 WITH HEADER LINE.
    DATA: MTAB_PROGRAM_TEXTS LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE.
    DATA: MSTR_THEAD LIKE THEAD.
    DATA: BEGIN OF MTAB_PROGRAM_FILE OCCURS 0,
             LINE(275) TYPE C,
           END OF MTAB_PROGRAM_FILE.
    DATA: BEGIN OF MTAB_DIRECTORY OCCURS 0,
             NAME LIKE TRDIR-NAME,
             DESC(72) TYPE C,
             SAVENAME LIKE RLGRAP-FILENAME,
           END OF MTAB_DIRECTORY.
    DATA: BEGIN OF MTAB_PROGRAM_DOCUMENTATION OCCURS 0,
             LINE(255) TYPE C,
           END OF MTAB_PROGRAM_DOCUMENTATION.
    Selection Screen
    *-- Options for upload/download of programs
    SELECTION-SCREEN BEGIN OF BLOCK FRM_OPTIONS WITH FRAME TITLE TEXT-UDL.
    PARAMETERS:
       RB_DOWN RADIOBUTTON GROUP UDL DEFAULT 'X'.       " Download reports
    SELECTION-SCREEN BEGIN OF BLOCK FRM_TRDIR WITH FRAME TITLE TEXT-DIR.
    SELECT-OPTIONS:
       S_NAME  FOR TRDIR-NAME,              " Program Name
       S_SUBC  FOR TRDIR-SUBC               " Program Type
               DEFAULT 'F' OPTION EQ SIGN E," Exclude Functions by default
       S_CNAM  FOR TRDIR-CNAM               " Created by
               DEFAULT SY-UNAME,
       S_UNAM  FOR TRDIR-UNAM,              " Last Changed by
       S_CDAT  FOR TRDIR-CDAT,              " Creation date
       S_UDAT  FOR TRDIR-UDAT.              " Last update date
    SELECTION-SCREEN END OF BLOCK FRM_TRDIR.
    *-- Options for uploading programs
    PARAMETERS:
       RB_UP   RADIOBUTTON GROUP UDL.       " Upload reports
    SELECTION-SCREEN BEGIN OF BLOCK FRM_UPLOAD WITH FRAME TITLE TEXT-UPL.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(29) TEXT-SNG.
    PARAMETERS:
       RB_FILE RADIOBUTTON GROUP HOW DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 33(42) TEXT-FNA.
    SELECTION-SCREEN END OF LINE.
    PARAMETERS:
       RB_LIST RADIOBUTTON GROUP HOW.
    SELECTION-SCREEN END OF BLOCK FRM_UPLOAD.
    SELECTION-SCREEN END OF BLOCK FRM_OPTIONS.
    *-- Options for up/downloading programs
    SELECTION-SCREEN BEGIN OF BLOCK FRM_FILEN WITH FRAME TITLE TEXT-FIL.
    PARAMETERS:
       RB_DOS  RADIOBUTTON GROUP FIL DEFAULT 'X', " Save to local
       RB_UNIX RADIOBUTTON GROUP FIL,       " Save to UNIX
       P_PATH  LIKE RLGRAP-FILENAME         " Path to save files to
             DEFAULT 'c:\abap\'.
    SELECTION-SCREEN END OF BLOCK FRM_FILEN.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-LOW.
       CALL FUNCTION 'F4_PROGRAM'
            EXPORTING
                 OBJECT             = S_NAME-LOW
                 SUPPRESS_SELECTION = 'X'
            IMPORTING
                 RESULT             = S_NAME-LOW
            EXCEPTIONS
                 OTHERS             = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-HIGH.
       CALL FUNCTION 'F4_PROGRAM'
            EXPORTING
                 OBJECT             = S_NAME-HIGH
                 SUPPRESS_SELECTION = 'X'
            IMPORTING
                 RESULT             = S_NAME-HIGH
            EXCEPTIONS
                 OTHERS             = 1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-LOW.
       PERFORM GET_NAME USING 'S_UNAM-LOW'
                     CHANGING S_UNAM-LOW.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-HIGH.
       PERFORM GET_NAME USING 'S_UNAM-HIGH'
                     CHANGING S_UNAM-HIGH.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-LOW.
       PERFORM GET_NAME USING 'S_CNAM-LOW'
                     CHANGING S_CNAM-LOW.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-HIGH.
       PERFORM GET_NAME USING 'S_CNAM-HIGH'
                     CHANGING S_CNAM-HIGH.
    TOP-OF-PAGE.
       IF RB_LIST = 'X'.
         FORMAT COLOR COL_HEADING.
         NEW-LINE.
         WRITE: AT 3 TEXT-H01,
                AT 15 TEXT-H03.
         FORMAT COLOR OFF.
       ENDIF.
    AT LINE-SELECTION.
       CHECK RB_LIST = 'X'.                 " only do in list mode
       READ LINE SY-CUROW FIELD VALUE MTAB_DIRECTORY-SAVENAME.
    *-- Read file into an internal table
       PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
                                     USING  MTAB_DIRECTORY-SAVENAME.
    *-- Split table into TADIR entry, report lines, and report text
       PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
                                          MTAB_PROGRAM_SOURCE
                                          MTAB_PROGRAM_TEXTS
                                          MTAB_PROGRAM_DOCUMENTATION
                                 CHANGING TRDIR
                                          MSTR_THEAD.
    *-- Save all of the data
       PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
                                        MTAB_PROGRAM_TEXTS
                                        MTAB_PROGRAM_DOCUMENTATION
                                 USING  TRDIR
                                        MSTR_THEAD.
    Start of processing
    START-OF-SELECTION.
       FORMAT COLOR COL_NORMAL.
       IF RB_DOWN = 'X'.
         PERFORM DOWNLOAD_REPORTS.
       ELSEIF RB_UP = 'X'.
         PERFORM UPLOAD_REPORTS.
       ENDIF.
    END-OF-SELECTION.
       IF RB_DOWN = 'X'.
         CONCATENATE P_PATH
                     'directory.txt'
           INTO P_PATH.
         PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_DIRECTORY
                                    USING  P_PATH.
       ENDIF.
          FORM UPLOAD_REPORTS                                           *
    FORM UPLOAD_REPORTS.
    *-- Can upload a reports entered in selection criteria or
    *-- select from a list.  List can be from index.txt in same directory
    *-- (created by the download) or by reading the first line of each file
    *-- in the directory.
       IF RB_FILE = 'X'. " Upload single program from a file
    *-- Read file into an internal table
         PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
                                       USING  P_PATH.
    *-- Split table into TADIR entry, report lines, and report text
         PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
                                            MTAB_PROGRAM_SOURCE
                                            MTAB_PROGRAM_TEXTS
                                            MTAB_PROGRAM_DOCUMENTATION
                                   CHANGING TRDIR
                                            MSTR_THEAD.
    *-- Save all of the data
         PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
                                          MTAB_PROGRAM_TEXTS
                                          MTAB_PROGRAM_DOCUMENTATION
                                   USING  TRDIR
                                          MSTR_THEAD.
       ELSEIF RB_LIST = 'X'. " Show list for user to choose from
    *-- get list of report names/descriptions from directory text
         CONCATENATE P_PATH
                     'directory.txt'
         INTO P_PATH.
         PERFORM READ_REPORT_FROM_DISK TABLES MTAB_DIRECTORY
                                       USING  P_PATH.
         SORT MTAB_DIRECTORY.
    *-- Write out list of report names/descriptions
         LOOP AT MTAB_DIRECTORY.
           WRITE:
             / MTAB_DIRECTORY-NAME UNDER TEXT-H01,
               MTAB_DIRECTORY-DESC UNDER TEXT-H03,
               MTAB_DIRECTORY-SAVENAME.
         ENDLOOP.
    *-- Process user selections for reports to upload.
       ENDIF.
    ENDFORM.                               " upload_reports
          FORM DOWNLOAD_REPORTS                                         *
          From the user selections, get all programs that meet the      *
          criteria, and save them in ftab_program_directory.            *
          Also save the report to disk.                                 *
    FORM DOWNLOAD_REPORTS.
       DATA:
         LC_FULL_FILENAME LIKE RLGRAP-FILENAME.
    *-- The table is put into an internal table because the program will
    *-- abend if multiple transfers to a dataset occur within a SELECT/
    *-- ENDSELCT (tested on 3.1H)
       SELECT * FROM  TRDIR
              INTO TABLE MTAB_PROGRAM_TRDIR
              WHERE  NAME  IN S_NAME
              AND    SUBC  IN S_SUBC
              AND    CNAM  IN S_CNAM
              AND    UNAM  IN S_UNAM
              AND    CDAT  IN S_CDAT
              AND    UDAT  IN S_UDAT.
       LOOP AT MTAB_PROGRAM_TRDIR.
    *-- Clear out text and source code tables
         CLEAR:
           MTAB_PROGRAM_FILE,
           MTAB_PROGRAM_SOURCE,
           MTAB_PROGRAM_TEXTS,
           MTAB_PROGRAM_DOCUMENTATION.
         REFRESH:
           MTAB_PROGRAM_FILE,
           MTAB_PROGRAM_SOURCE,
           MTAB_PROGRAM_TEXTS,
           MTAB_PROGRAM_DOCUMENTATION.
    *-- Get the report
         READ REPORT MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_SOURCE.
    *-- Get the text for the report
         READ TEXTPOOL MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_TEXTS.
    *-- Get the documentation for the report
         CLEAR DOKIL.
         SELECT * UP TO 1 ROWS FROM DOKIL
                WHERE  ID          = 'RE'
                AND    OBJECT      = MTAB_PROGRAM_TRDIR-NAME
                AND    LANGU       = SY-LANGU
                AND    TYP         = 'E'
                ORDER BY VERSION DESCENDING.
         ENDSELECT.
    *-- Documentation exists for this object
         IF SY-SUBRC = 0.
           CALL FUNCTION 'DOCU_READ'
                EXPORTING
                     ID      = DOKIL-ID
                     LANGU   = DOKIL-LANGU
                     OBJECT  = DOKIL-OBJECT
                     TYP     = DOKIL-TYP
                     VERSION = DOKIL-VERSION
                IMPORTING
                     HEAD    = MSTR_THEAD
                TABLES
                     LINE    = MTAB_PROGRAM_DOCUMENTATION
                EXCEPTIONS
                     OTHERS  = 1.
         ENDIF.
    *-- Put the report code and texts into a single file
    *-- Put the identifier line in so that the start of the TRDIR line
    *-- is marked
         CONCATENATE MC_TRDIR_IDENTIFIER
         MTAB_PROGRAM_TRDIR-NAME
         INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
    *-- Add the TRDIR line
         MTAB_PROGRAM_FILE-LINE = MTAB_PROGRAM_TRDIR.
         APPEND MTAB_PROGRAM_FILE.
    *-- Put the identifier line in so that the start of the report code
    *-- is marked
         CONCATENATE MC_REPORT_IDENTIFIER
                     MTAB_PROGRAM_TRDIR-NAME
           INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
    *-- Add the report code
         LOOP AT MTAB_PROGRAM_SOURCE.
           MTAB_PROGRAM_FILE = MTAB_PROGRAM_SOURCE.
           APPEND MTAB_PROGRAM_FILE.
         ENDLOOP.
    *-- Put the identifier line in so that the start of the report text
    *-- is marked
         CONCATENATE MC_TEXT_IDENTIFIER
                     MTAB_PROGRAM_TRDIR-NAME
           INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
    *-- Add the report texts
         LOOP AT MTAB_PROGRAM_TEXTS.
           MTAB_PROGRAM_FILE = MTAB_PROGRAM_TEXTS.
           APPEND MTAB_PROGRAM_FILE.
         ENDLOOP.
    *-- Put the identifier line in so that the start of the THEAD record
    *-- is marked
         CONCATENATE MC_THEAD_IDENTIFIER
                     MTAB_PROGRAM_TRDIR-NAME
           INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
         MTAB_PROGRAM_FILE = MSTR_THEAD.
         APPEND MTAB_PROGRAM_FILE.
    *-- Put the identifier line in so that the start of the report
    *-- documentation is marked
         CONCATENATE MC_DOC_IDENTIFIER
                     MTAB_PROGRAM_TRDIR-NAME
           INTO MTAB_PROGRAM_FILE-LINE.
         APPEND MTAB_PROGRAM_FILE.
    *-- Add the report documentation
         LOOP AT MTAB_PROGRAM_DOCUMENTATION.
           MTAB_PROGRAM_FILE = MTAB_PROGRAM_DOCUMENTATION.
           APPEND MTAB_PROGRAM_FILE.
         ENDLOOP.
    *-- Make the fully pathed filename that report will be saved to
         CONCATENATE P_PATH
                     MTAB_PROGRAM_TRDIR-NAME
                     '.txt'
           INTO LC_FULL_FILENAME.
         PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_PROGRAM_FILE
                                    USING  LC_FULL_FILENAME.
    *-- Write out message with Program Name/Description
         READ TABLE MTAB_PROGRAM_TEXTS WITH KEY ID = 'R'.
         IF SY-SUBRC = 0.
           MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
           MTAB_DIRECTORY-DESC = MTAB_PROGRAM_TEXTS-ENTRY.
           MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
           APPEND MTAB_DIRECTORY.
           WRITE: / MTAB_PROGRAM_TRDIR-NAME,
                    MTAB_PROGRAM_TEXTS-ENTRY(65) COLOR COL_HEADING.
         ELSE.
           MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
           MTAB_DIRECTORY-DESC = 'No description available'.
           MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
           APPEND MTAB_DIRECTORY.
           WRITE: / MTAB_PROGRAM_TRDIR-NAME.
         ENDIF.
       ENDLOOP.
    ENDFORM.                               " BUILD_PROGRAM_DIRECTORY
          FORM SAVE_TABLE_TO_FILE                                       *
    -->  FTAB_TABLE                                                    *
    -->  F_FILENAME                                                    *
    FORM SAVE_TABLE_TO_FILE TABLES FTAB_TABLE
                             USING  F_FILENAME.
       IF RB_DOS = 'X'.                  " Save file to presentation server
         CALL FUNCTION 'WS_DOWNLOAD'
              EXPORTING
                   FILENAME = F_FILENAME
                   FILETYPE = 'ASC'
              TABLES
                   DATA_TAB = FTAB_TABLE
              EXCEPTIONS
                   OTHERS   = 4.
         IF SY-SUBRC NE 0.
           WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
                    F_FILENAME COLOR COL_NEGATIVE.
         ENDIF.
       ELSE.                                " Save file to application serve
         OPEN DATASET F_FILENAME FOR OUTPUT IN TEXT MODE.
         IF SY-SUBRC = 0.
           LOOP AT FTAB_TABLE.
             TRANSFER FTAB_TABLE TO F_FILENAME.
             IF SY-SUBRC NE 0.
               WRITE: / 'Error writing record to file;' COLOR COL_NEGATIVE,
                        F_FILENAME COLOR COL_NEGATIVE.
             ENDIF.
           ENDLOOP.
         ELSE.
           WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
                    F_FILENAME COLOR COL_NEGATIVE.
         ENDIF.
       ENDIF.                               " End RB_DOS
    ENDFORM.                               " SAVE_PROGRAM
          FORM READ_REPORT_FROM_DISK                                    *
          Read report into internal table.  Can read from local or      *
          remote computer                                               *
    FORM READ_REPORT_FROM_DISK TABLES FTAB_TABLE
                                USING  F_FILENAME.
       DATA:
          LC_MESSAGE(128) TYPE C.
       CLEAR   FTAB_TABLE.
       REFRESH FTAB_TABLE.
       IF RB_DOS = 'X'.
         TRANSLATE F_FILENAME USING '/\'.   " correct slash for Dos PC file
         CALL FUNCTION 'WS_UPLOAD'
              EXPORTING
                   FILENAME            = F_FILENAME
                   FILETYPE            = 'ASC'
              TABLES
                   DATA_TAB            = FTAB_TABLE
              EXCEPTIONS
                   CONVERSION_ERROR    = 1
                   FILE_OPEN_ERROR     = 2
                   FILE_READ_ERROR     = 3
                   INVALID_TABLE_WIDTH = 4
                   INVALID_TYPE        = 5
                   NO_BATCH            = 6
                   UNKNOWN_ERROR       = 7
                   OTHERS              = 8.
         IF SY-SUBRC >< 0.
           WRITE: / 'Error reading file from local PC' COLOR COL_NEGATIVE.
         ENDIF.
       ELSEIF RB_UNIX = 'X'.
         TRANSLATE F_FILENAME USING '\/'.   " correct slash for unix
         OPEN DATASET F_FILENAME FOR INPUT MESSAGE LC_MESSAGE IN TEXT MODE.
         IF SY-SUBRC = 0.
           DO.
             READ DATASET F_FILENAME INTO FTAB_TABLE.
             IF SY-SUBRC = 0.
               APPEND FTAB_TABLE.
             ELSE.
               EXIT.
             ENDIF.
           ENDDO.
           CLOSE DATASET F_FILENAME.
         ELSE.
           WRITE: / 'Error reading file from remote computer'
                           COLOR COL_NEGATIVE,
                  / LC_MESSAGE,
                  / F_FILENAME.
           SY-SUBRC = 4.
         ENDIF.
       ENDIF.
    ENDFORM.                               " READ_REPORT_FROM_DISK
          FORM SPLIT_INCOMING_FILE                                      *
    -->  FTAB_PROGRAM_FILE                                             *
    -->  FTAB_PROGRAM_SOURCE                                           *
    -->  `                                                             *
    -->  FTAB_PROGRAM_TEXTS                                            *
    FORM SPLIT_INCOMING_FILE TABLES FTAB_PROGRAM_FILE
                                          STRUCTURE MTAB_PROGRAM_FILE
                                     FTAB_PROGRAM_SOURCE
                                          STRUCTURE MTAB_PROGRAM_SOURCE
                                     FTAB_PROGRAM_TEXTS
                                          STRUCTURE MTAB_PROGRAM_TEXTS
                                     FTAB_PROGRAM_DOCUMENTATION
                                       STRUCTURE MTAB_PROGRAM_DOCUMENTATION
                            CHANGING FSTR_TRDIR
                                     FSTR_THEAD.
       DATA:
         LC_DATATYPE(4) TYPE C,             " Type of data, REPO, TEXP, RDIR
         LC_PROGRAM_FILE LIKE MTAB_PROGRAM_FILE.
       LOOP AT FTAB_PROGRAM_FILE.
         LC_PROGRAM_FILE = FTAB_PROGRAM_FILE.
         CASE LC_PROGRAM_FILE(9).
           WHEN MC_TRDIR_IDENTIFIER.
             LC_DATATYPE = MC_TRDIR_SHORT.
           WHEN MC_REPORT_IDENTIFIER.
             LC_DATATYPE = MC_REPORT_SHORT.
           WHEN MC_TEXT_IDENTIFIER.
             LC_DATATYPE = MC_TEXT_SHORT.
           WHEN MC_DOC_IDENTIFIER.
             LC_DATATYPE = MC_DOC_SHORT.
           WHEN MC_THEAD_IDENTIFIER.
             LC_DATATYPE = MC_THEAD_SHORT.
           WHEN OTHERS. " Actual contents of report, trdir, or text
             CASE LC_DATATYPE.
               WHEN MC_TRDIR_SHORT.
                 FSTR_TRDIR = FTAB_PROGRAM_FILE.
               WHEN MC_REPORT_SHORT.
                 FTAB_PROGRAM_SOURCE = FTAB_PROGRAM_FILE.
                 APPEND FTAB_PROGRAM_SOURCE.
               WHEN MC_TEXT_SHORT.
                 FTAB_PROGRAM_TEXTS = FTAB_PROGRAM_FILE.
                 APPEND FTAB_PROGRAM_TEXTS.
               WHEN MC_THEAD_SHORT.
                 FSTR_THEAD = FTAB_PROGRAM_FILE.
               WHEN MC_DOC_SHORT.
                 FTAB_PROGRAM_DOCUMENTATION = FTAB_PROGRAM_FILE.
                 APPEND FTAB_PROGRAM_DOCUMENTATION.
             ENDCASE.
         ENDCASE.
       ENDLOOP.
    ENDFORM.                               " SPLIT_INCOMING_FILE
          FORM INSERT_NEW_REPORT                                        *
    -->  FTAB_PROGRAM_SOURCE                                           *
    -->  FTAB_PROGRAM_TEXTS                                            *
    -->  F_TRDIR                                                       *
    FORM INSERT_NEW_REPORT TABLES FTAB_PROGRAM_SOURCE
                                       STRUCTURE MTAB_PROGRAM_SOURCE
                                   FTAB_PROGRAM_TEXTS
                                        STRUCTURE MTAB_PROGRAM_TEXTS
                                   FTAB_PROGRAM_DOCUMENTATION
                                        STRUCTURE MTAB_PROGRAM_DOCUMENTATION
                            USING  FSTR_TRDIR LIKE TRDIR
                                   FSTR_THEAD LIKE MSTR_THEAD.
       DATA:
         LC_OBJ_NAME LIKE E071-OBJ_NAME,
         LC_LINE2(40)     TYPE C,
         LC_ANSWER(1)     TYPE C.
    *-- read trdir to see if the report already exists, if it does, prompt
    *-- user to overwrite or abort.
       SELECT SINGLE * FROM TRDIR WHERE NAME = FSTR_TRDIR-NAME.
       IF SY-SUBRC = 0.                     " Already exists
         CONCATENATE 'want to overwrite report'
                     FSTR_TRDIR-NAME
           INTO LC_LINE2 SEPARATED BY SPACE.
         CONCATENATE LC_LINE2
           INTO LC_LINE2.
         CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
              EXPORTING
                  DEFAULTOPTION  = 'N'
                  TEXTLINE1   = 'The selected report already exists, do you'
                  TEXTLINE2      = LC_LINE2
                  TITEL          = 'Report already exists'
                  CANCEL_DISPLAY = SPACE
              IMPORTING
                   ANSWER         = LC_ANSWER
              EXCEPTIONS
                   OTHERS         = 1.
       ELSE.
         LC_ANSWER = 'J'.
       ENDIF.
       IF LC_ANSWER = 'J'.
    *-- Create the TADIR entry.  (TRDIR entry created by INSERT REPORT)
         LC_OBJ_NAME = TRDIR-NAME.
         CALL FUNCTION 'TR_TADIR_POPUP_ENTRY_E071'
              EXPORTING
                   WI_E071_PGMID     = 'R3TR'
                   WI_E071_OBJECT    = 'PROG'
                   WI_E071_OBJ_NAME  = LC_OBJ_NAME
                   WI_TADIR_DEVCLASS = '$TMP'
              EXCEPTIONS
                   EXIT              = 3
                   OTHERS            = 4.
         IF SY-SUBRC = 0.
    *-- Create Report
           INSERT REPORT FSTR_TRDIR-NAME FROM FTAB_PROGRAM_SOURCE.
    *-- Create Texts
           INSERT TEXTPOOL FSTR_TRDIR-NAME FROM FTAB_PROGRAM_TEXTS
                  LANGUAGE SY-LANGU.
    *-- Save Documentation
           CALL FUNCTION 'DOCU_UPDATE'
                EXPORTING
                     HEAD    = FSTR_THEAD
                     STATE   = 'A'
                     TYP     = 'E'
                     VERSION = '1'
                TABLES
                     LINE    = FTAB_PROGRAM_DOCUMENTATION
                EXCEPTIONS
                     OTHERS  = 1.
         ELSE.
           WRITE: / 'Error updating the TADIR entry' COLOR COL_NEGATIVE,
                    'Program' COLOR COL_NEGATIVE INTENSIFIED OFF,
                    FSTR_TRDIR-NAME, 'was not loaded into SAP.'
                       COLOR COL_NEGATIVE INTENSIFIED OFF.
         ENDIF.
       ELSE.
         WRITE: / FSTR_TRDIR-NAME COLOR COL_NEGATIVE,
                  'was not uploaded into SAP.  Action cancelled by user'
                      COLOR COL_NEGATIVE INTENSIFIED OFF.
       ENDIF.
    ENDFORM.                               " INSERT_NEW_REPORT
          FORM GET_NAME                                                 *
    -->  VALUE(F_FIELD)                                                *
    -->  F_NAME                                                        *
    FORM GET_NAME USING VALUE(F_FIELD)
                CHANGING F_NAME.
       DATA: LTAB_FIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
             LC_PROG LIKE D020S-PROG,
             LC_DNUM LIKE D020S-DNUM.
       TRANSLATE F_FIELD TO UPPER CASE.
       refresh ltab_fields.
       LTAB_FIELDS-FIELDNAME = F_FIELD.
       append ltab_fields.
       LC_PROG =  SY-REPID .
       LC_DNUM =  SY-DYNNR .
       CALL FUNCTION 'DYNP_VALUES_READ'
            EXPORTING
                 DYNAME     = LC_PROG
                 DYNUMB     = LC_DNUM
            TABLES
                 dynpfields = ltab_fields
            EXCEPTIONS
                 OTHERS     = 01.
       read table ltab_fields index 1.
       IF SY-SUBRC EQ 0.
         F_NAME = LTAB_FIELDS-FIELDVALUE.
         refresh ltab_fields.
       ENDIF.
       CALL FUNCTION 'F4_USER'
            EXPORTING
                 OBJECT = F_NAME
            IMPORTING
                 RESULT = F_NAME.
    ENDFORM.                               " GET_NAME
    This is the entire program.hope it helops you.
    Reward if useful
    Regards
    divya

  • Code for downloading a file

    Can some one provide me wit da code for downloadind a file.

    import com.jscape.inet.ftp.*;
    Establishing a connection
    In order to communicate with an FTP server you must first establish a network connection to the FTP server.
    // create Ftp instance with FTP hostname, username and password as arguments
    Ftp ftp = new Ftp("ftp.myserver.com","jsmith","secret");
    // establish connection
    ftp.connect();
    Perform a directory listing
    Once connected you may wish to perform a directory listing on the FTP server. The directory listing will return a relative listing of files and directories that are on the FTP server.
    // perform directory listing
    String listing = ftp.getDirListingAsString();
    // print directory listing to console
    System.out.println(listing);
    Alternatively you may use the getDirListing method. This method parses the results and returns a java.util.Enumeration of FtpFile. Using this method you may then iterate through the Enumeration and evaluate the contents of each file or directory programmatically. Note: This method is only for use by FTP servers which display directory listing using the UNIX or MS-DOS mode. For more information see the Ftp.getDirListing method in the JavaDoc.
    // Perform directory listing
    Enumeration files = ftp.getDirListing();
    // iterate through listing
    while(files.hasMoreElements()) {
    FtpFile file = (FtpFile)files.nextElement();
    // only print files that are directories;
    if(file.isDirectory()) {
    System.out.println(file.getName());
    Changing your local directory
    Your local directory is the directory that you wish to use when transferring files to / from the FTP server. By default this is the directory that the Java executable was invoked from. To change this setting simply invoke the setLocalDir method.
    // change local directory
    ftp.setLocalDir(new File("C:/tmp");
    Changing your remote directory
    Your remote directory represents your current directory on the FTP server. By default this is the directory that is assigned when first logging into the FTP server. To change this setting simply invoke the setDir method.
    // Change remote directory
    ftp.setDir("temp");
    Setting the transfer mode
    Files transferred to / from an FTP server may be transmitted using binary or ASCII modes. The binary transfer mode transfers files without performing any conversion. Binary transfer is generally used for files that are binary in nature such as images, executables etc. The ASCII transfer mode transfers files converting new line characters to the system dependent new line character used by the operating system performing the transfer request. ASCII transfer mode is generally used when downloading text only files. The default transfer mode is binary.
    // change transfer mode to ASCII
    ftp.setAscii();
    // change transfer mode to binary
    ftp.setBinary();
    Downloading files
    To download a file simple invoke the download method. File will be transferred using the current transfer mode and saved in your local directory. See Setting the transfer mode and Changing your local directory for more information. There are other methods that you may use for downloading files. These include methods for downloading entire directories and downloading files matching a regular expression. For more information see the JavaDoc.
    // download a file named test.txt in remote directory
    ftp.download("test.txt");
    Uploading files
    To upload a file simply invoke the upload method. File will be transferred using the current transfer mode and saved in your remote directory. See Setting the transfer mode and Changing your remote directory for more information. There are other methods that you may use for uploading files. These include methods for uploading entire directories and uploading files matching a regular expression. For more information see the JavaDoc.
    // upload a file named test.txt in c:/tmp directory
    ftp.upload(new File("c:/tmp/test.txt"));
    Releasing the connection
    Once you have finished sending your email message(s) it is important that you disconnect from the FTP server. This is easily accomplished using the code below.
    // release the FTP server connection
    ftp.disconnect();
    With Regards,
    Dipak Sodani.

  • How to schedule a program for download a file to Presentation Server

    hi all,
    I need to schedule a program which will download a file to presentation server. How can i handle this or is there any other to download a file during scheduling?
    Points will be rewarded
    Thanks in advance

    Hi Jayasree,
    You can download your file to application server in background scheduling.
    In your program use OPEN DATASET command for achieving this.
    How ever, as far as i know, it is not possible to download the file to presentation server in background job.
    regards,
    G@urav.

  • Help Firefox will not "open containing folder" for downloaded .rar files

    I have to open a file that is in my FF downloads but none of the .RAR files will open the containing folder. I have quite a few .rar files none of them will open. Windows 7 PC

    Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default:
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    Please report back to see if this helped you!

  • Tips for downloading big files(World Of Warcraft)

    I need to download this 8 gigs of the game more. I'm downloading directly from bilzzard its going about 150 kb/s. Just wonder some tips yall do when downloading big files like this. Also if my macbook pro goes to sleep will it slow down the download because thats what seems to happen when I leave it on overnight.

    Do it in the evening through overnight. Set the MBP to not sleep. System Preferences>Energy Saver>Computer Sleep = Never.

  • Problem with encoding and charset for downloading a file

    Hi guys, I have a problem and I beg for your help, I am 1000% frustrated at this point.
    I have a servlet which have to do something and give a file log to the final user. Coding the logic for that took me about 5 minutes, the problem is that the given file doesnt shows properly in notepad (Default app to open txt files). I have tried every way I have read over the internet and absolutely nothing works.
    After trying about 20 different ways fo doing this without success, this is my actual code:
    Charset def=Charset.defaultCharset();
    OutputStreamWriter out = new OutputStreamWriter(servletOutputStream,def);
    for (String registry:regList) {
    out.write(registry+"\n");
    out.close();
    the page gives the file to the user, I can download or open it, when I open it this is the result
    registry1registry2registry3registry4registry5registry6registry7...
    and I am expecting:
    registry1
    registry2
    registry3
    registry4
    registry5
    If I open it with wordpad or notepad++ the file looks fine, but I cant achieve that notepad reads it correctly. I have spent about 10 hours on this and at this point I just dont know what to do, i have tried Windows-1252, UTF-8, UTF-16, the Default one. I have tried to set this enconding on the response header with no luck. Any help will be very appreciated.
    Thanks in advance.

    >
    I have a servlet which have to do something and give a file log to the final user. Coding the logic for that took me about 5 minutes, the problem is that the given file doesnt shows properly in notepad (Default app to open txt files). I have tried every way I have read over the internet and absolutely nothing works.
    If I open it with wordpad or notepad++ the file looks fine, but I cant achieve that notepad reads it correctly. I have spent about 10 hours on this and at this point I just dont know what to do, i have tried Windows-1252, UTF-8, UTF-16, the Default one. I have tried to set this enconding on the response header with no luck. Any help will be very appreciated.
    >
    Your file likely uses *nix style line endings and use a single LF (0x0A) as the end of each line.
    Notepad doesn't recognize a single LF as the end of line; it expects CRLF (0x0D0A). The encoding isn't the issue.
    If you have to use Notepad you will need to add code to find all of the LF characters and insert a CR character in front of them.

  • How to create a link for download a file in text format

    Hi expect,
    I want to create a link when I link that link a text file should get download which i'm specified in jsp page. I tried by using hyper link it didn't get downloaded just it opened as it is. How can I resolve the problem.

    Swati.S wrote:
    in href provide another jsp name or servlet and pass filename as request parameter to this jsp or servlet. In called jsp or servlet set content type to application/forcedownload.Yes, that works (usually), but, IMHO, is nothing but a hack that you shouldn't use (and I could care less how often it is currently used in varying hacked scripts, such as this bogus force-download PHP script I've seen). That is an invalid MIME type (or at least unofficial/non-standard mime tye that most browsers will have no association for), so, since the browser doesn't know what to do with it, it'll ask the user what to do. And even that is not 100% certain. All I need do is create a mime-type to application association for that MIME type and, guess what, it doesn't work again (at least not the way you intended).
    The server should not be concerned with what the client does with the file linked to.

  • Servlet for plain HTML files? (i.e. not JSPs)

    Hello,
    I have a webapp that includes plain-old HTML files (in a WAR) and a servlet that executes and then dispatches the request to a plain-old HTML file.
    When this runs I get this error:
    500 Internal Server Error
    Cannot get request dispatcher for path foo/bar.html
    I am not sure what the problem is, but I think it may be that this is an HTML file (as opposed to a JSP file), and my OC4J instance is not configured to handle HTML files.
    So, my question is: How do I configure OC4J to handle plain HTML files?
    In config/global-web-application.xml I see several servlets, one for JSPs, one for CGI, for SSI, for Perl, for PHP.... but how do I handle just HTML?
    Thanks,
    Otis

    Hello Steve,
    I think this exception may explain what I'm seeing:
    java.lang.ClassNotFoundException: introduction.videos._tasks__welcome
         at oracle.jsp.runtimev2.JspClassLoader.loadClass(JspClassLoader.java:758)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at oracle.jsp.runtimev2.JspPageInfo.getInstFacade(JspPageInfo.java:167)
         at oracle.jsp.runtimev2.JspPageInfo.compileAndLoad(JspPageInfo.java:451)
         at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:542)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:304)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    So, it looks like OC4J is using a JspServlet and JspClassLoader to try to load:
    _introduction._videos._tasks__welcome.class
    However, that "_tasks__welcome" is not a Java class - it is a regular .html file that lives in my WAR file as:
    tpri/introduction/videos/tasks_welcome.html
    So it looks like I have to tell OC4J not to try to load .html files as JSPs and treat them as plain HTML files that they are. Is there a way to do this with OC4J? (9.0.4.0.0)
    Thanks,
    Otis

  • Two different methods for downloading a file using URL...

    I was just wondering if someone could shed some light on whether I should be downloading files using java.net.URL or java.net.URLConnection
    Here are two ways that I have found to work (and yes I realize that one is outputting to a stream and the other is getting put into a StringBuffer):
          InputStream in = url.openStream();
          byte[] b = new byte[buffSize];
          fileOutStream = new FileOutputStream(fileToBeCreated);
          while ((bytesRead = in.read(b)) != -1){
            totalFileSize+=bytesRead;
            fileOutStream.write(b, 0, bytesRead);
          }and
          URLConnection _con = url.openConnection();
          in = new BufferedReader(new InputStreamReader(_con.getInputStream()));
          String inputLine;
          while ((inputLine = in.readLine()) != null){
              webPageStringBuff.append(inputLine+"\r\n");
          }In both of the above cases url is just a URL object that has already been instantiated with a valid URL.
    So, just to re-iterate, I realize that the output portion of this code is doing something different (i.e. writing to a stream as opposed to appending to a StringBuffer) but I would like to know whether there is any reason to choose using the URLConnection to get the stream as opposed to using the URL to get the stream.
    Thanks,
    Tim

    hi,
    try out the following code
    // Program: copyURL.java
    // Author: Anil Hemrajani ([email protected])
    // Purpose: Utility for copying files from the Internet to local disk
    // Example: 1. java copyURL http://www.patriot.net/users/anil/resume/resume.gif
    // 2. java copyURL http://www.ibm.com/index.html abcd.html
    import java.net.*;
    import java.io.*;
    import java.util.Date;
    import java.util.StringTokenizer;
    class copyURL
    public static void main(String args[])
    if (args.length < 1)
    System.err.println
    ("usage: java copyURL URL [LocalFile]");
    System.exit(1);
    try
    URL url = new URL(args[0]);
    System.out.println("Opening connection to " + args[0] + "...");
    URLConnection urlC = url.openConnection();
    // Copy resource to local file, use remote file
    // if no local file name specified
    InputStream is = url.openStream();
    // Print info about resource
    System.out.print("Copying resource (type: " +
    urlC.getContentType());
    Date date=new Date(urlC.getLastModified());
    System.out.println(", modified on: " +
    date.toLocaleString() + ")...");
    System.out.flush();
    FileOutputStream fos=null;
    if (args.length < 2)
    String localFile=null;
    // Get only file name
    StringTokenizer st=new StringTokenizer(url.getFile(), "/");
    while (st.hasMoreTokens())
    localFile=st.nextToken();
    fos = new FileOutputStream(localFile);
    else
    fos = new FileOutputStream(args[1]);
    int oneChar, count=0;
    while ((oneChar=is.read()) != -1)
    fos.write(oneChar);
    count++;
    is.close();
    fos.close();
    System.out.println(count + " byte(s) copied");
    catch (MalformedURLException e)
    { System.err.println(e.toString()); }
    catch (IOException e)
    { System.err.println(e.toString()); }
    ok

  • Why do i get a decompression failed notice for downloading zip files

    I'm trying to download my marks for my class and they were posted in a .zip file. however in the downloads box it's telling me that 'decompression failed' and when I try opening it it cannot be opened because it 'is still being downloaded'. I used to be able to open the files, but I don't know what I did.
    I'm new to macs, so it's challenging for me to figure out what the exact problem is, and then to find the solution.
    Thanks for your time!

    Greetings,
    This may be an issue with the specific Zip file you are trying to open (in which case contact your teacher to have them emailed to you separately).
    Make your own Zip file by clicking on any document (like a picture) on the desktop and then go to File > Compress.  Try opening the resulting Zip file and see if it works.  If it works then whatever is going on is with that particular Zip file.  Make sure you are giving the file long enough to download.

  • Which page has a button to open a library tree javaapplet for download pdf files?

    i have got the page and download some pdf files like "PLSQL User Guide and Reference" for oracle 8.1.6. But i cannt find it from the download documentation page now. please help me, i wanna download some basic concepts pdf for oracle. thks

    This is not something that you can set in the code I provided. There's an app-wide setting that can be set (in principle) using code, but it's not a good idea to change it, because it applies to other documents as well.
    And regarding JS and CodeAcademy: It's always a good idea to try to learn more, but keep in mind that Acrobat JS is quite a niche thing, quite different from the kind of JS that is used in web-pages. You can find more information about it here:
    http://www.adobe.com/devnet/acrobat/javascript.html
    And here:
    http://acrobatusers.com/tutorials

Maybe you are looking for

  • How to Use Save_Text

    HI Friends,           i have downloaded material code, material type and po text in one text file by using read_text function.         now i want to upload it into new system how can i do that? i am using save_text function to  save it into new SAP s

  • N900 IMAP EMAIL

    Hello. I have a small "problem". I am using Nokia N900 with my email based on IMAP. Email is incoming perfectly, however only makes BEEP when incoming to the incom folder and no sounds when incoming to other folders I have with filters... What can I

  • Materials on ESS Customization

    Hi gurus, Does anyone have any documents/materials that help guide on how to customize ESS/MSS business packages in NWDI? I'm struggling to find any guide or examples that are specific to ESS/MSS customization in NWDI. Thank you.

  • 802.1x deployment with MAC filtering

    Hi All I read "Enhance your 802.1x deployment security with MAC filtering" on NAP blogs with link as below. http://blogs.technet.com/nap/archive/2006/09/08/454705.aspx I am wondering this tip might not be correct somehow and would like to know how to

  • ListCellRenderer and JList... cannot set the selected background?

    The following code:      public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus )           setText( "test" );           setBackground( isSelected ? list.getSelectionBackground() :