How to generate a file from JSP form

Hi,
I want to generate a file from the informations of a form(JSP).
Which classes do I have to use ?
Thanks.

Of course you have to use the standard servlet classes to retrieve the request parameters from the form.
ie request.getParameter();
package "java.io" gives you File input/output ability.
If you are generating a text file, thats probably the BufferedWriter and FileWriter classes.
Cheers,
evnafets

Similar Messages

  • How to run batch file from oracle forms 9i

    Hi everyone.
    i have a data in csv file. i want to upload it to my database. i am using sql loader for it.
    i have made a batch file which run the sql loader and transfer my data to database.
    How to run batch file from oracle forms 9i.
    when i press the button, nothing uploads in my database. (when i simply run the batch file it works).
    here is my code
    Begin
    HOST('C:\temp\batchfile.bat');
    message('done');
    end;
    Thanks in advance
    regards
    sajid

    this is my log file, when i run manually.
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jul 1 23:27:53 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: file_to_upload.ctl
    There are 2 data files:
    Data File: sk.csv
    Bad File: sk.bad
    Discard File: none specified
    (Allow all discards)
    Data File: sk1.csv
    Bad File: sk1.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table KHAN, loaded from every logical record.
    Insert option in effect for this table: APPEND
    Column Name Position Len Term Encl Datatype
    SR FIRST * , O(") CHARACTER
    DATES NEXT * , O(") CHARACTER
    AGENT NEXT * , O(") CHARACTER
    COUNTRY NEXT * , O(") CHARACTER
    TRANSACTIONS NEXT * , O(") CHARACTER
    PKR NEXT * , O(") CHARACTER
    USD NEXT * , O(") CHARACTER
    BANK NEXT * , O(") CHARACTER
    Table KHAN:
    11088 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 132096 bytes(64 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 11088
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Jul 01 23:27:53 2010
    Run ended on Thu Jul 01 23:27:54 2010
    Elapsed time was: 00:00:00.63
    CPU time was: 00:00:00.17

  • How to generate .DTD file from IDOC?

    Dear All,
    On behalf of my colleague,
    How to generate .DTD file from IDOC? I want to generate this file for importing into the WebMethod Tool. Please share relevant content regarding the same.
    IDOC name is: BOMMAT01
    Let me know if you need any other information.
    Regards,
    JK

    Hi Jitendra,
    When PI receives idoc from ECC it will be in xml format.
    Are you telling that you want to convert this xml to .dtd file?
    check this for converting xml into .dtd file.
    How to convert XML file into DTD or XSD
    could you please explain about what you are doing in this requirement?
    After importing into WebMethod what is the next action?
    do they want to send the file to PI?

  • Generate .PDF file from Oracle Form and print .pdf

    Hello, I am new to oracle form. I need direction on how to create .pdf file on a button click.
    The requirement is when user click a button on a form, I need to write some data to the pdf file and open the .pdf file for print.
    I am using Oracle Form builder 10.1.2.0.2
    Thanks a lot! Please help!

    Dear all,am new to oracle report and oracle forms and i know the
    basics how to generate the report and to create the form, Now my doubt is, like generating report
    from oracle report how to generate the report from oracle from,should i add any command button? and where
    to add the coding and what coding ? when i click that command button the report should be generated like oracle
    report,what should i do?Please help me to learn.
    my table name is 'student' and it has the following columns,
    sid,sname,grade,result.
    Am using oracle from 10.1.2.0.2 version and
    oracle report version is 10.1.2.0.2.
    Please give step by step procss.
    Thank you.

  • How to generate .java file from xml?

    Does anyone have an idea of how i can generate .java file from xml file? Tools like jakrata digester, JOX are there but both of them are useful in populating java beans from xml. My requirement is to generate .java file from .xml with getters and setters methods for xml elements/attributes. I also tried JAXB. But JAXB generates bunch of files and most of them are interfaces, which is not going to work for me.
    For e.g. i have following xml file and i want to generate Address.java file with getters/setters. Any ideas?
    <?xml version='1.0' encoding='UTF-8' ?>
    <Address>
    <FirstName type="String"/>
    <PoBox type="int"/>
    </Address>
    Thanks,
    Vicky

    Crosspost.
    http://forum.java.sun.com/thread.jsp?thread=475564&forum=4&message=2205846

  • How to generate Word document from JSP ?

    Hi,
    I want to generate Word documnet from JSP. I am using Neva objects to generate Word document. Now my problem is Word doc generation code works alright as a Java application but when I place that piece of code in a JSP bean it throws an exception. The reason seems to be unavailibility of DLLs and other files of Neva in Tomcat environment. I do not want to use other complex packages like JIntegra, I would prefer any freeware solution. There is not much info. about Word document generation on POI project in Jakarta site.
    Could anyone suggest way out ? Any Java examples doing the same would be of great help.
    Thanks,
    Akash

    Hi Saurabh,
    Thanks for the reply.
    I have tried that too. Problem with that solution is that if you have used CSS in your JSP code MS word does not understand it and generates word doc which is not the same as HTML which JSP otherwise would have generated.
    Akash

  • How to generate XML file from SQL file !

    I am new to XML publisher. I known one way to generate XML file is register one report file in concurrent manager.
    But I want to generate XML file from sql file.
    Could someone show me how to code in sql file, how to register is in concurrent manager.
    Thanks !

    Hi
    Phew ... not sure we have the space here. So I can point you in the right direction:
    1. XML data generation - there are two packages in the db you can use with a plsql procedure, XMLGEN and SQL XML. You can also use java APIs too. Try checking the db documentation and search for the above methods.
    2. Registering the report - the system administrators guide will provide this info. Hooking the program up with XMLP is covered here - http://www.oracle.com/technology/products/applications/publishing/resource/CM%20Whitepaper5.0.pdf
    Regards, Tim

  • How to execute batch file from JSP

    hi frens !
    i wanna know how to execute batch file from my JSP.i am using exec() method to get call the batch file. but its not working ....plz help
    here mine code:-
    File F = new File("C:/var.bat");
         try{
          if (F.exists())
            Runtime rt = Runtime.getRuntime();
            String url=F.getAbsolutePath();
             Process proc = rt.exec(url);
            proc.waitFor();
            proc.destroy();
            catch(Exception IOEx){
           System.out.println(IOEx);
      }Thanks and Regards
    Allwyn

    You might improve your chances of getting help if you do two things:
    1) Explain what "not working" means.
    2) ChangeSystem.out.println(IOEx); to IOEx.printStackTrace(); (in the eventhat is in fact related to "not working").

  • How to open .cmdrw file from Oracle Forms 10g

    Hi,
    We need to call *.cmdrw* file from Oracle forms 10g. Is there any way to call *.cmdrw* file from Oracle forms 10g?
    Thanks for the help.
    Viishnu Nekkanti

    In case you want to open a .cmdrw with its associated application you can use the following procedure:
    webutil_host.NonBlocking( 'rundll32 url.dll,FileProtocolHandler ' || client_filename );This works for every file where a program has been associated to its file extension. (Adobe Reader for *.pdf, Microsoft Word for *.doc, Microsoft Excel for *.xls and so on)
    Regards
    Markus

  • How to generate java file from WSDL file

    Hi friends,
    I am new to this thing, so that's why I need some guidence .
    I need to generate java file programatically from existing wsdl file.
    I thought the ways - to use xmlbeans apache library or jaxb.
    Can you suggest what will be better way to generate java file from wsdl? can you please be more descriptive and can you direct me to appropriate link?
    Thanks.
    Harshit

    xmlbeans apache provides easiest way to create java file from wsdl there is very good link for that
    http://www.ibm.com/developerworks/webservices/library/ws-soa-clientxmlbeans.html
    If you want more programmatic approach then Jaxb will be a better option

  • How to generate MT files from Oracle EBS Payables

    Hi, does anyone has experience in generating MT files from Oracle Payables?
    All contributions are welcome...

    Hi,
    are you talking about MT-940 format files? If so, what is the use case behind this issue?
    I created a custom loader process to upload MT-940 bank statements into Cash Management
    some time ago, but as far as i understood your question, you want to create those files based
    on payables data?
    Regards

  • Best Practices:: How to generate XML file from a ResultSet

    Hi all,
    Could someone please suggest the best practices of how to generate an XML file from a resultset? I am developing a web application in Java with Oracle database and one of my tasks is to generate an XML file when the user, for example, click a "download as XML" button on the JSP. The application is basically like an Order with line items. I am using Struts and my first thought has been to have an action class which will extend struts's DownloadAction and through StAX's Iterator API to create an XML file. I intend to have a POJO which will have properties of all columns of my order and line items tables so that for each order I get all line items and:
    1. Write order details then
    2. Through an iterator write line items of that order to an XML file.
    I will greatly appreciate for comments or suggestions on the best way to do this through any pointers on the Web.
    alex

    Use a OracleWebRowSet in which an XML representation of the result set may be obtained.
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/oracle10g/webrowset/Readme.html
    http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/jcrowset.htm

  • How to generate PDF file from HTML file using Acrobat API's

    Hi,
    I want to generate a PDF file from an HTML file on server side(C# .Net).
    Their is a COM interop called "AcrobatWeb2PDF" availaible but could not find any document regarding how to use it.
    I cant use "Adobe live cycle PDF Generator" as we just have license for Adobe Acrobat 8 Professional.
    Please help...
    Thanks and Regards,
    Anand Mahadik.

    > It is hard to believe that Adobe doesn't provide a toolkit for generating PDF files, so many web based applications have vector based content that needs to be converted to PDF!!!!
    They do, it's just not free (A company in business to make money? I'm sure IBM would never think this way... ;)). As mentioned you have Adobe LiveCycle PDF Generator, which you can customize and extend with Java. You also have the Adobe PDF Library SDK, which is written for use with C/C++ although if you license it from Datalogics (the only company in NA Adobe allows to license the PDF Library) you will also get .NET and Java interfaces (part of the DLE - DataLogics Extensions).
    > There must be a way to generate PDF dynamically on a server or from Javascript!
    JavaScript? Not really, no. As far as I'm aware JavaScript has no file system access capabilities without some form of intermediary (like sending the data to a webservice that writes it out to file). How would you create a PDF file with JavaScript?
    The PDF Standard is also in ISOs hands now (ISO 32000-1:2008), it is no longer owned by Adobe - you can download a copy of the specification from them and write your own library based on that as well.

  • How to generate excel file in oracle forms 10g on client machine

    dear Sir,
    I am using just file server(installed 10g dev suite) not a oracle application server,
    I am running my application from another machine ,it running fine i want to generate excel report on client machine
    presently i m using OLE2 for fetching the data in excel , it is working fine but it generates the excel file on file server machine and i want get the output excel on the client machine. aftre OLE2 i m using CLIENT_OLE2 with webutil (instead of OLE2) its get compile successfully but during runtime it give error "oracle.forms.webutil.ole.OleFunctions bean not "found.CLIENT_OLE2.create_obj will not work"
    *so please tell me without oracle application server is this possible or not .*

    your webutil on server side is not configured
    you need to re install the webutil jacob.dll files etc. then it will work fine..
    you can also generate excel file using reports to change the destination format in SPREADSHEET

  • How to generate .txt file from data in internal table

    Hi I am using the program below to load .txt file into SAP table.
    I am moving the records from a .txt file into internal table final and then into ZOUT_CCFOBS table.
    How do I load records from internal table final back to another .txt file with the same layout? Pls advice.
    REPORT  ZOUP_LOAD_CCF_OBS.
    TABLES: ZOUT_CCFOBS.
    TYPES: BEGIN OF tline, "structure to store a line of each row
        line(1000) TYPE c,
    END OF tline.
    TYPES: BEGIN OF i_split, "structure to store split record of each row
          t_ZOTFACIL(100)    TYPE c,
          t_ZOTCCF(8)    TYPE c,
          t_ZOTOBSCAT(100)    TYPE c,
    END OF i_split.
    DATA: itab TYPE TABLE OF tline WITH HEADER LINE.
    DATA: idat TYPE TABLE OF i_split WITH HEADER LINE.
    DATA: final TYPE STANDARD TABLE OF ZOUT_CCFOBS WITH HEADER LINE.
    DATA: file_str TYPE string.
    DATA: c_fnh_mask TYPE dxfields-filemask VALUE '.',
          c_search_dir TYPE dxfields-longpath.
    SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
    PARAMETERS p_file LIKE rlgrap-filename.                "file location
    SELECTION-SCREEN END OF BLOCK a1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM f4_dxfilename USING p_file.
    START-OF-SELECTION.
    Download data from application server
      PERFORM download_data.
      file_str = p_file.
      LOOP AT itab.
        CLEAR idat.
    this will split the line at every delimeter into single field
        SPLIT itab-line AT ',' INTO idat-t_ZOTFACIL
        idat-t_ZOTCCF
        idat-t_ZOTOBSCAT.
        APPEND idat.
      ENDLOOP.
    copying the internal table into final table which compatible with table tcurr
      LOOP AT idat.
        final-ZOTFACIL = idat-t_ZOTFACIL.
        final-ZOTCCF = idat-t_ZOTCCF.
        final-ZOTOBSCAT = idat-t_ZOTOBSCAT.
        APPEND final.
      ENDLOOP.
      LOOP AT final.
        MODIFY ZOUT_CCFOBS FROM final.
        IF sy-subrc EQ 0.
          MESSAGE S001(ZCURR).
        ELSE.
          MESSAGE A000(ZCURR).
        ENDIF.
      ENDLOOP.
    FORM f4_dxfilename USING p_file.
    addition TAICK 15/07/2008.
    *maintain application server default search path.
      IF sy-sysid = 'BWP'.
        c_search_dir = '//rdmsbw/prd/data/output/all'.
      ELSEIF sy-sysid = 'BWQ'.
        c_search_dir = '//rdmsbw/uat/data/output/all'.
      ELSEIF sy-sysid = 'BWD'.
        IF sy-mandt = '900'.
          c_search_dir = '//rdmsbw/sit/data/output/all'.
        ELSE.
          c_search_dir = '//rdmsbw/dev/data/output/all'.
        ENDIF.
      ENDIF.
      DATA: wa_file LIKE dxfields-longpath.
      CLEAR: wa_file.
      CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
        EXPORTING
          i_location_flag = 'A'
          i_server        = ' '
          i_path          = c_search_dir
          filemask        = c_fnh_mask
          fileoperation   = 'R'
        IMPORTING
          o_path          = wa_file
        EXCEPTIONS
          rfc_error       = 1
          error_with_gui  = 2
          OTHERS          = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        p_file = wa_file.
      ENDIF.
    addition end TAICK 15/07/2008.
    ENDFORM. " f4_dxfilename
    FORM download_data .
      OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      DO.
        IF sy-subrc <> 0.
          exit.
        ENDIF.
        READ DATASET p_file INTO itab.
        if sy-subrc = 0.
          APPEND itab.
        clear itab.
        endif.
      ENDDO.
      CLOSE DATASET p_file.
      delete itab index 1. "remove column header
    ENDFORM.                    " download_data
    Edited by: RebekahMBB on Feb 20, 2012 12:56 PM

    Hi I am using this piece of code to download my internal table into an .xls file on my pc.
    FORM Z_CONVERT_EXCEL .
      "This part of code to add column name in the downloaded file.
      data : begin of int_head occurs 0,
      Filed1(20) type c,                     " Header Data
      end of int_head.
      int_head-Filed1 = 'ZOTOUS'.
      APPEND int_head.
      CLEAR int_head.
      int_head-Filed1 = 'ZOTOUS'.
      APPEND int_head.
      CLEAR int_head.
      int_head-Filed1 = 'ZOTOGCUR'.
      APPEND int_head.
      CLEAR int_head.
    Select ZOTOUS ZOTSYORGU ZOTOGCUR from ZOUT_ORG_CURR into CORRESPONDING FIELDS OF TABLE itab.
      v_filetype = '.xls'. "I just manipulate the file name using XLS file type.
      v_filename = 'C:\Documents and Settings\00088592\Desktop\OUs automation\development'.
      CONCATENATE v_filename v_filetype INTO lv_filename.
      CALL FUNCTION 'GUI_DOWNLOAD'
       EXPORTING
            filename         = lv_filename
            filetype         = 'ASC'
          APPEND           = 'X'
            write_field_separator = 'X'
          CONFIRM_OVERWRITE = 'X'
       TABLES
            data_tab         = itab
            FIELDNAMES       = int_head
       EXCEPTIONS
            file_open_error  = 1
            file_write_error = 2
            OTHERS           = 3.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.                    "Z_CONVERT_EXCEL
    As you can see the code specifies the header row separately and appends it in int_head.
    What if I have 76 fields or more? I cant be specifying each like that.
    Is there any other way to do this? To move the 76 field headers into int_head?
    Pls help.
    Thanks!

Maybe you are looking for