How to provide/pass filenames to af:fileDownloadActionListener method.

Hi,
I have a use case that lets the user download a list of files that are in the filesystem.
Is there a way to pass the file names to the af:filedownloadActionListener method?
<af:commandButton value="Download File 1">
<af:fileDownloadActionListener filename="file1.txt"
contentType="text/plain; charset=utf-8"
method="#{myBean.doDownload}"/>
</af:commandButton>
<af:commandButton value="Download File 2">
<af:fileDownloadActionListener filename="file2.pdf"
contentType="text/plain; charset=utf-8"
method="#{myBean.doDownload}"/>
</af:commandButton>
Can I access the filename attribute of af:fileDownloadactionListener programmatically somehow?
public void doDownload(FacesContext facesContext, OutputStream out) {
try {
FileInputStream fis;
fis =new FileInputStream(Filename????); // how does one get the file name
int n;
byte[] b;
while ((n = fis.available()) > 0) {
b = new byte[n];
int result = fis.read(b);
out.write(b, 0, b.length);
} catch (IOException e) {e.printStackTrace();}
Please help with any suggestion, examples or links.
Thanks

Hi All,
Does anyone have an idea on how to resolve of passing download file name to the fileDownloadActionListener action? Frank suggested using memory attribute, but I do not know to do that. Can any one show me how to accomplish that.
Thanks,
T.A

Similar Messages

  • How do u pass an object into a method

    I want to create a method getData that takes an object of type Helper and returns an object of the same type.
    how do u pass objects into a method and how do u get objects as returns im a bit confused

    That will just allow you to pass a parameter. If you want to return a helper object
    Helper paramHelper = new Helper();
    Helper someHelper = callMethod(paramHelper);
    public Helper callMethod(Helper hobj) {
        //<some code>
        Helper retHelper = new Helper();
        //<blah, blah>
        return retHelper;

  • How do I pass an array to a method?

    Hopefully you guys don't mind answering one of my stupid questions :o(
    I have problem passing an array to a method.
    //Here is the code that calls to the method:
    String[] Folder = new String[19];
    int cnt;
    for(cnt=0; cnt<20; cnt++){
    Folder[cnt] = request.getParameter("searchfolder_name" + (cnt + 1));
    ProcessNotify(Folder[cnt]);
    //================================================================
    //Here the the method that is supposed to take in the array
    private void ProcessNotify(String FolderName[]){
    FolderName = new String[19];
    int cnt;
    for(cnt=0; cnt<20; cnt++){
    System.out.println("Folder Name: " + FolderName[cnt]);
    I got an error that says java.lang.String[] can not be applied to java.lang.String
    I thought "String FolderName[]" is an array? Anyway... I'm confused. If you know the answer, plz let me know :o) big thx
    lil

    ProcessNotify(Folder[cnt]);
    Are you trying to pass the whole array or just one piece from it? What you coded, tried to pass just one piece by specifying a subscript. BTW variable cnt is a subscript out of range.
    If you meant to pass the whole array, just use it's name with no subscript.

  • How to provide specific filename on FTP PUT in OSB

    Hi --
    I'm trying to use an OSB dataflow to FTP PUT a file. The filename is to be derived based on the file's contents, according to a naming convention required by the client. I have a proxy service with a Routing action that has a Transport Header on its Request Action flow; on the Outbound Request, I specify a JCA header of jca.ftp.FileName and provide a variable where the derived filename has been stored, and Pass All Headers is checked. The resulting $outbound variable contains exactly what I expected:
    <con:transport>
         <con:mode>request-response</con:mode>
         <con:qualityOfService>best-effort</con:qualityOfService>
         <con:request
              xsi:type="ftp:FtpRequestMetaData"
              xmlns:ftp="http://www.bea.com/wli/sb/transports/ftp"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
              <tran:headers
                   xsi:type="ftp:FtpRequestHeaders"
                   xmlns:tran="http://www.bea.com/wli/sb/transports">
                   <tran:user-header name="jca.ftp.FileName" value="ASN_M_C_201192715483296.xml"/>
                   <tran:user-header name="Content-Type" value="text/xml; charset=utf-8"/>
              </tran:headers>
              <tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
              <ftp:isFilePath>false</ftp:isFilePath>
         </con:request>
    </con:transport>
    ... But then the FTP PUT ignores the filename and writes one of those long generated alphanumeric ones instead.
    I can't find anything definite in any documentation, but it seems like jca.ftp.FileName might only be used for FTP GET, not FTP PUT ( ? ).
    There has to be a straightforward way to specify the name you want on an FTP PUT. I'm new at OSB. Can anyone tell me what I'm missing? :-)
    Thanks!

    Colleague suggested not using JCA:jca.ftp.FileName as the transport header, but ftp:fileName instead. Works.

  • New IPhone 5. Apple id is my email address. when I try to set up i cloud it automaticly changes my apple pass word to my provider pass word. How can I get it to stay my apple pass word?

    New IPhone 5. Apple id is my email address. when I try to set up i cloud it automaticly changes my apple pass word to my provider pass word. How can I get it to stay my apple pass word?

    Thanks for the flag J.K. - they contaced me and solved my problem.  On this account (which I created just to ask this question), I log in with my email rather than my user name (mtalldud). On the account that I was having trouble with, they told me to use my user ID instead of my email to log in and it worked. This is a bit confusing and seems a bit inconsistent but at least I don't need this temporary account any more to get into this community and find answers!

  • How to Provide search Help for files on Application Server

    Hi Guys,
                   Can anyone tell me How to Provide search Help for files on Application Server. I have put a file name on selection screen. I want to give search help for files on application server.
    Thanks & Regards.
    Harish.

    Hi Harish,
    Use the following code,
    tables sxpgcotabe.
    data: lt_execprot LIKE btcxpm OCCURS 0 WITH HEADER LINE,
            w_filepath(60)       TYPE c, --> length depending on your Directory path.
      SELECT SINGLE *
        FROM sxpgcotabe
             WHERE name = 'LIST_DB2DUMP'
               AND opsystem = sy-opsys.
      IF sy-subrc <> 0.
        SELECT SINGLE *
          FROM sxpgcotabe
               WHERE name = 'LIST_DB2DUMP'
                 AND opsystem = 'UNIX'.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'External operating system command '
                            'LIST_DB2DUMP not found'.
        ENDIF.
      ENDIF.
      sxpgcotabe-parameters = p_filepath. --> provide the directory path.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
           EXPORTING
                commandname                   = sxpgcotabe-name
                additional_parameters         = sxpgcotabe-parameters
                operatingsystem               = sxpgcotabe-opsystem
           TABLES
                exec_protocol                 = lt_execprot 
           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 <> 0.
        MESSAGE e000 WITH text-e01 p_filepath.  "Directory failed
      ENDIF.
    Loop round the directory list, split each line up into a line table
    and get the last data for each line, should be the filename
    Then build the dirlist.
      REFRESH t_dirlist.
      LOOP AT lt_execprot.
        REFRESH t_dirline.
        SPLIT lt_execprot-message AT space INTO TABLE t_dirline.
        DESCRIBE TABLE t_dirline LINES w_nolines.
        READ TABLE t_dirline INDEX w_nolines.
        MOVE t_dirline-data TO t_dirlist-filename.
        APPEND t_dirlist.
      ENDLOOP.
    Here you will get all the files in the directory mentioned in Application server.
    For displaying them as a Search help use the FM '/BMC/ZPOPUP_GET_VALUE'
    Pass the Internal table to this FM.
    Regards,
    Paul.

  • How can I pass more than one parameters in PDK-URL services?

    Hi all,
    How can I pass more than one parameters in PDK-URL service? All samples on Portal Center shows just one parameter passing.
    <inputParameter class="oracle.portal.provider.v1.URLPortletParameter">
    <name>csz</name>
    <isMandatory>false</isMandatory>
    <displayName>What location do you want a map for (City, State or Zip)?</displayName>
    </inputParameter>
    How can I write the privider.xml file for passing multiple parameters?

    I answer to my question. I've got the answer.
    I repeatly write down the <inputParameter> tags, and it works.

  • How to generate unique filenames??

    i need to be able to generate unique files from a servlet..
    my initial instinct was to use the seesion id as part of the filename, however as this file will be embedded in the responding html, this is not safe, as the user will only have to look at the html source to view a session id value.
    i am now considering to use the date/time of the creation of a session as the unique identifier for the file, however this will not work if two sessions can be created at the same time.
    my question thefore is if no two sessions can have the same date and time?
    if not.. can anyone give me an idea as how to produce unique filenames?

    If you are actually creating a file, why not usethe
    java.io.File.createTempFile() method?how does that help with prducing a unique value to use
    as the name of a file?
    with that method i still need to supply the filename
    as one of its arguments!
    No you don't. You provide a prefix and suffix and it fills in the middle with something guaranteed to be unique, in the directory you specify. Here is the javadoc:
    createTempFile
    public static File createTempFile(String prefix,
    String suffix,
    File directory)
    throws IOException
    Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. If this method returns successfully then it is guaranteed that:
    1. The file denoted by the returned abstract pathname did not exist before this method was invoked, and
    2. Neither this method nor any of its variants will return the same abstract pathname again in the current invocation of the virtual machine.
    This method provides only part of a temporary-file facility. To arrange for a file created by this method to be deleted automatically, use the deleteOnExit() method.
    The prefix argument must be at least three characters long. It is recommended that the prefix be a short, meaningful string such as "hjb" or "mail". The suffix argument may be null, in which case the suffix ".tmp" will be used.
    To create the new file, the prefix and the suffix may first be adjusted to fit the limitations of the underlying platform. If the prefix is too long then it will be truncated, but its first three characters will always be preserved. If the suffix is too long then it too will be truncated, but if it begins with a period character ('.') then the period and the first three characters following it will always be preserved. Once these adjustments have been made the name of the new file will be generated by concatenating the prefix, five or more internally-generated characters, and the suffix.
    If the directory argument is null then the system-dependent default temporary-file directory will be used. The default temporary-file directory is specified by the system property java.io.tmpdir. On UNIX systems the default value of this property is typically "/tmp" or "/var/tmp"; on Microsoft Windows systems it is typically "c:\\temp". A different value may be given to this system property when the Java virtual machine is invoked, but programmatic changes to this property are not guaranteed to have any effect upon the the temporary directory used by this method.
    Parameters:
    prefix - The prefix string to be used in generating the file's name; must be at least three characters long
    suffix - The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used
    directory - The directory in which the file is to be created, or null if the default temporary-file directory is to be used
    Returns:
    An abstract pathname denoting a newly-created empty file
    Throws:
    IllegalArgumentException - If the prefix argument contains fewer than three characters
    IOException - If a file could not be created
    SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.lang.String) method does not allow a file to be created
    Since:
    1.2

  • How to provide f4 help

    Hi guys,
      here i amproviding some sample code.
    requirement is uploading data from xl to internal table.
    problem is how to provide f4 help for file name.
    using cl_gui_frontend_services.
    type mismatching is occuring.
    DATA:  wa_filename1 TYPE file_table,        "for method
           wa_filename2 TYPE rlgrap-filename,   "for function module
           wa_data TYPE alsmex_tabline.
    DATA:    t_data TYPE STANDARD TABLE OF alsmex_tabline.
    DATA:      file_count TYPE i.
    selection-screen begin of block bk1 with frame title text-001.
    parameters:p_fname type char10.
    selection-screen end of block bk1.
    at selection-screen on value-request for p_fname.
    Method to get filename
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      EXPORTING
        window_title            = 'Excel file name'
      CHANGING
        file_table              = P_fname
        rc                      = file_count
      EXCEPTIONS
        file_open_dialog_failed = 1
        cntl_error              = 2
        error_no_gui            = 3
        not_supported_by_gui    = 4
        OTHERS                  = 5.
    start-of-selection.
    LOOP AT p_fname INTO wa_filename1.
      wa_filename2 = wa_filename1.
    To upload excel to internal table
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = wa_filename2
          i_begin_col             = 1
          i_begin_row             = 1
          i_end_col               = 2
          i_end_row               = 88
        TABLES
          intern                  = t_data
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
    *ENDLOOP.
    u can expect more rewards.

    my code sample:
    REPORT  zcobkk01.
    * INCLUDES                                                             *
    INCLUDE zcobkk01top.
    * SELECTION-SCREEN                                               *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETER p_file TYPE string OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    * AT SELECTION-SCREEN                                                          *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CLEAR it_file.
      CLEAR v_rc.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = 'title here'
          initial_directory       = 'C:'
        CHANGING
          file_table              = it_file
          rc                      = v_rc
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5.
      IF sy-subrc EQ 0.
        READ TABLE it_file INDEX 1 INTO p_file.
      ENDIF.
    * START-OF-SELECTION                                                   *
    START-OF-SELECTION.
      PERFORM load_file USING p_file
                             CHANGING it_return.
      IF it_return IS NOT INITIAL.
        PERFORM validate_data USING it_return
                              CHANGING  it_input
                                        it_err.
        PERFORM display_err CHANGING it_err.
      ELSE.
        WRITE: 'Error'.
      ENDIF.

  • How to provide security settings for the adobe form using livecycleDesigner

    Hello,
    I am very new to form designing,
    can any one please tell me how to provide security settings for the adobe forms at client side?
    Regards,
    Menaka

    Hi,
    that is a good topic for the ADFS forum.
    ADFS forum - http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=Geneva
    But you could pass the user-agent as incoming claim type Client User agent. User-agents can be manipulated, so if that is an issue you can look into Device Registration and the Device OS type from there. That is also a incoming claim but requires DRS and
    DRS is not available for all plattforms.
    Hth,
    Lutz

  • How can I pass objects across neywork?

    How can I pass a ObjectOutputStream to a ObjectInputStream, across a socket?
    Thanks in advance for your posts!

    Or maybe I am misunderstanding your question?-Probably
    Lets see: ObjectOutputStream passes data trought aout
    Stream; ObjectInputStream receives data trought a in
    Stream: so, I suppose that they can use as streamsthe
    connections betwen two sockets, in one point the
    ObjectOutputStream sending, an in another the
    ObjectInputStream receiving.Yes. The sockets provide the connections, and you can
    call getInputStream or getOutputStream on the sockets
    to read what the other guy is sending, or to write to
    the other guy. You don't actually pass the sockets or
    streams back and forth--they're just the channels by
    which you pass your data.I knew that, thanks anyway. But my question is how can I pass objects throught that streams.
    Anyone knows?
    Thanks

  • How can we read filenames from a specific folder

    Hi forum,
    I have a situation that, there are several files coming daily in a specific folder.
    I want to read filenames from that folder and want to get that filename in a variable.
    That filename contains account nos. which I need for further processing.
    Now, how can we read filenames from a specific folder with using Oracle PL/SQL Procedure?
    Please suggest.
    Thanks & regards,
    Kiran

    If you are on 10g (not sure which exact release I'm afraid) you might look at Chris Poole's XUTL_FINDFILES that lists the files in a directory using PL/SQL and DBMS_BACKUP_RESTORE.SEARCHFILES (all a bit undocumented as it seems to be provided as part of rman).
    The conventional (i.e. supported) approach is to use a Java stored procedure - there is an example on AskTom.
    Message was edited by:
    William Robertson

  • How can I pass a Presentation Variable (Date) into a prompt

    Hello
    How can I pass a Presentation Variable (date) into a prompt? I seem to be able to do this successfully for a non-date value but have had no luck with a Date variable.
    Here's a simplistic version of what I'm trying to do:
    1. I have a Presentation Variable called startDate which is a Date that defaults to this SQL - SELECT "Reporting Dates"."Measure Date" FROM Trading WHERE "Reporting Dates"."Date Name" = 'Current'.
    2. I now want to pass this variable into a prompt with SQL like this: SELECT "Position Date"."Position Date" FROM Trading where "Position Date"."Position Date" = date'@{startDate}{2009-04-24}'
    I get this error: Datetime value @{startDate}{2009-04-24} from @{startDate}{2009-04-24} does not match the specified format.
    Now I can use the exact same syntax in a filter. For example, a simple Answers request where I pick Position Date with a filter saying "Position Date"."Position Date" = date'@{startDate}{2009-04-24}' works fine.
    What am I doing wrong?
    Thanks!

    Can you provide more information please?
    1. What is the format of the first date prompt, is it YYYY-MM-DD or?
    2. Which data type is Position Date."Position Date" in the physical layer, date or date time?
    3. What is the column formula in the first prompt?
    4. The first prompt is set to drop-down or?
    5. If you are using this SQL Results in the second prompt:
    SELECT "Position Date"."Position Date" FROM Trading where "Position Date"."Position Date" = date '@{startDate}{2009-04-24}'
    then @{startDate} must be in YYYY-MM-DD format to work properly, otherwise (for example):
    datetime value 01/01/2000 from 01/01/2000 does not match the specified format.
    This doesn't work for example:
    SELECT Times.time_id FROM "Normal model" where Times.time_id =date '01/01/2000'
    Regards
    Goran
    http://108obiee.blogspot.com

  • (264361962) Q ADVC-27 How do you pass the security info to access the EJB?

    Q<ADVC-27> How do you pass the security info to access the EJB?
    A<ADVC-27> Authentication for web service users must occur at the web layer. This
    means providing appropriate web resource definitions and restrictions in the web.xml
    file for your project. The most common and useful form of security for application
    interaction is via client-side certificates. Then the client identity is transmitted
    to the EJB is the same way as in regular J2EE environments. There is a complete description
    on security on e-docs:
    http://edocs.bea.com/workshop/docs70/help/guide/security/ovwSecurity.html
    Adam

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (119093)

  • How to provide the F4 functionality to the files on application server

    Hi,
    How to provide the F4 functionality to the files on application server at selection screen.as it is F4_FILENAME for files on desktop , is there any Function module for this purpose also. I did a search in R/3 but didnt get any FM .Please advise.
    Regards,
    sam.

    You can get to it  using frontend class CL_GUI_FRONTEND_SERVICES if you know the host name and have the correct permissions, for example, this program works great for me in my system.
    report zrich_0001 .
    data: ifiletable type filetable.
    data: xfiletable like line of ifiletable.
    data: rc type i.
    parameters: p_file1 type localfile default'\sapprdusr'.
    at selection-screen on value-request for p_file1.
    call method cl_gui_frontend_services=>file_open_dialog
       EXPORTING
    *    WINDOW_TITLE            =
    *    DEFAULT_EXTENSION       =
    *    DEFAULT_FILENAME        =
    *    FILE_FILTER             =
         INITIAL_DIRECTORY       = '\sapprdusr'
    *    MULTISELECTION          =
      changing
        file_table              = ifiletable
        rc                      = rc
    *    USER_ACTION             =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        others                  = 4.
    read table ifiletable into xfiletable index 1.
    if sy-subrc = 0.
      p_file1 = xfiletable-FILENAME.
    endif.
    Regards,
    Rich Heilman

Maybe you are looking for

  • How to process vendor credit card payment

    I need so help understanding the proper way to process a credit card payment to a vendor.  I know how to go into outgoing payments and enter the credit card in the payment means, but that does NOT create a payable invoice under my credit card vendor.

  • Snow Leopard - Save as PDF file size

    Since my Acrobat Printer no longer works after upgrading to Snow Leopard, when I "save as PDF" the file size is several times what the output used to be using the Printer.  So saving Illustrator or InDesign files where the Mac OS PDF printer can't be

  • Flex and Seam

    Do you think it may be possible to integrate Flex Data Services with JBoss's Seam framework? Thanks, Pepe.

  • Web graphics / images display in low resolution on any web browser

    Hi everyone. This issue has had me stumped for a few months now. I never noticed this issue with Snow Leopard but now with Lion I have noticed that web graphics display at a significantly lower resolution. I switch between Google Chrome and Safari an

  • Can't update camera raw in PSE 10- error message. Tried downloading manually but doesn't work.

    Need help updating to 6.7 RAW for my new camera for PSE 10. Update though help gives error message. Tried to disable firewall but still doesn't work.  Tried to download manually, but the program doesn't acknowledge it, could I have put it in the wron