How to generate html-code using csv input with JSP or JAVA???

Hello,
I want to read out a .csv-file and generate html-code dynmically with JSP in an EP6 Application. The problem is, that the csv-file can’t be located or openend.
BTW if every knows a good tutorial or weblog for this, please post the link.
It’s located in a par-archive under:
/>dist>files
I tried various methods, in the doContent mehtod or with JSP. Everytime same result.
Here part of the code I tried in the doContent():
public class CSV extends AbstractPortalComponent
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
        String strWRoot = request.getWebResourcePath();
        String contentCSV="", line="";
        String linesep = System.getProperty("line.separator");
        File fileLoadCSV = new File(strWRoot+"/files/ma_infosysteme.csv");
        boolean exCSV = fileLoadCSV.exists();
        boolean reCSV = fileLoadCSV.canRead();
        int a=0;
        if(exCSV&&reCSV){
            response.write("ok");
            try {
              BufferedReader inputCSV = new BufferedReader(new FileReader(fileLoadCSV));
              while((line=inputCSV.readLine())!=null){
                contentCSV=contentCSVlinelinesep;
                a++;
              inputCSV.close(); 
            catch(IOException ioex){
                System.out.println("Fehler");  
        else {
            response.write("not ok");
        response.write("<br>Wroot: "+strWRoot);
        response.write("<br>File: "+fileLoadCSV);
        response.write("<br>exists: "+exCSV);
        response.write("<br>read: "+reCSV);
        response.write("<br>Input: "+contentCSV);
The Output is:
not ok
Wroot: /irj/portalapps/DHTML
File: \irj\portalapps\DHTML\files\ma_infosysteme.csv
exists: false
read: false
Input:
So thanks to everyone who can give me a good hint.
Bye.

Without really looking too much into this it looks like the problem is with the way in which you are trying to open the file. I believe that when creating a File object you need to use a physical path. By using the getWebResourcePath() method you are retrieving the URL to this file and not the physical path name. There is another method (can't remember the exact name) called getPublicResourcePath() (or something similar) which will return the physical path to this file, i.e. c:\usr\sap\.....etc. If you try it this way it may well work
I hope this helps
D

Similar Messages

  • How to keep HTML code in the applet source (.java) file itself?

    Hi,
    How to keep HTML code (APPLET tag) in the applet source (.java) file itself?
    Please give an example?
    thank you,

    R6i wrote:
    ...What I mean is without writing external HTML file, how to run an applet (during practice)?'Practice'? What does that mean? During development? If that is what you are referring to, add an applet tag at the top of YourApplet.java inside a Java comment area. Then AppletViewer (in recent SDKs) can then run it with just..
    prompt:javac YourApplet.java
    prompt:// the '.java' extension is not a mistake
    prompt:appletviewer YourApplet.javaIf you do not mean 'during development', then that brings us back to +"What advantages do you see that is bringing to the end user?".+

  • How to display xslt generated html code?

    Hi,
    I transformed xml code into html code inside my action
    class and put generated code into StringWriter, I
    don't
    know how I can display it on my jsp page?
    I tried to turn generated html code into a big string,
    then use bean:write to display it on jsp page, it just
    does not work.
    Has anyone done this kind of thing?
    thanks

    hi
    Just put that String in JSP expression <%= String name %>
    u will see it on browser
    thanks
    hithesh

  • Error in generating HTML output using Central Output Pro Server 5.5

    I am getting the following error while generating HTML output using the Output Pro Server. A new printer was created with the Physical Device as "HTML Template Generation - [html]" and added to the Job.<br /><br />2004/05/07 20:09:53 D:\Program Files\Adobe\Central\Bin\jfmerge: [400](1801) The printer name is invalid.<br /><br />2004/05/07 20:09:53 D:\Program Files\Adobe\Central\Bin\jfmerge: [3015]Error, unable to open printer.<br />2004/05/07 20:09:53 D:\Program Files\Adobe\Central\Bin\jfmerge: [3008]Error, unable to get info about device 'PAYMENTADVICEHTM.html' attached to port '<nil>'.<br />2004/05/07 20:09:53 D:\Program Files\Adobe\Central\Bin\jfmerge: [400](183) Cannot create a file when that file already exists.<br /><br />2004/05/07 20:09:53 D:\Program Files\Adobe\Central\Bin\jfmerge: [2]Error opening output device/file 'PAYMENTADVICEHTM.html'.<br />2004/05/07 20:09:53 D:\Program Files\Adobe\Central\Bin\jfmerge: [400](6) The handle is invalid.<br /><br />2004/05/07 20:09:53 D:\Program Files\Adobe\Central\Bin\jfmerge: [3018]Error ending page on printer.<br />2004/05/07 20:09:53 D:\Program Files\Adobe\Central\Bin\jfmerge: [210]Nothing was printed.<br />2004/05/07 20:09:53 D:\Program Files\Adobe\Central\Bin\jfserver.exe: [314]Agent exit message: [3018]Error ending page on printer.

    If I were to guess, I'd guess that your filename is invalid. How about removing all special characters (spaces, brackets, etc.) from the device name. Also, make sure your form was compiled for HTML.
    I haven't actually used the HTML driver, but these are general things you should do if you have trouble with any Central driver.
    Regards,
    Rob McDougall
    Indigo Pacific

  • How to write html code in narrative

    Hi,
    How to write html code in narrative to get following format
    desc value1 Value2 totalvalue
    a 10 20 30
    b 20 30 50
    Totalvalue 30 50 80
    Total % 0.3 0.5 0.8
    Can any one help guide on writing HTMl code for above table format in narrative type of display data at report level
    Thank you
    Manu

    Hi Balu,
    If you are using the Web Application server (WEBAs), Then you can create applications using BSP( Bussiness server pages). Which is some what luike JSP.
    Or
    In SE80 , Try to create internet service files uisng BHTML. In the dropdown select internet service. And then try to create the HTML templates
    Thanks,
    Sarayoodharan.K

  • How to clean the html code multiple pages simultaneously with Dreamweaver or other soft ?

    hello,
    How to clean the html code multiple pages simultaneously with Dreamweaver or other soft ? I have hundreds of pages to clean
    Thanks !

    I would start afresh. I would also use Dreamweaver's template system to make thing a lot easier. Have a look at the following, copy and paste into a new document and view in your favourite browser.
    <!doctype html>
    <html>
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css" />
    <script type="text/javascript" src="ScriptLibrary/jquery-latest.pack.js"></script>
    <script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
    <style>
    .hline {
        background: url(http://yannick.michelat.free.fr/barre.gif);
        height: 10px;
        margin-top: 10px;
        margin-bottom: 10px;
    </style>
    </head>
    <body>
    <div class="container">
        <div class="row">
            <div class="col-xs-7">
                <img alt="" class="img-responsive pull-right" style="margin-top:20px;" src="http://yannick.michelat.free.fr/Calanques.gif" />
            </div>
            <div class="col-xs-5">
                <img alt="" class="img-responsive center-block" style="margin-top: 40px;" src="http://yannick.michelat.free.fr/grandportfolio.gif" />
            </div>
        </div>
        <div class="row hline"></div>
        <div class="row">
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-01.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-02.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-03.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-04.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-05.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-06.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-07.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-08.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-09.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-10.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-11.jpg" alt="" class="img-responsive"></a></div>
            <div class="col-xs-6 col-sm-4 col-md-2"> <a href="#" class="thumbnail"> <img src="http://yannick.michelat.free.fr/vign__CalanquesConseil-12.jpg" alt="" class="img-responsive"></a></div>
        </div>
        <div class="row hline"></div>
    </div>
    </body>
    </html>

  • How to embed html code in flash builder 4 ?

    How to embed html code in flash builder 4 ?

    Ya i tried by keeping <fx:Declarations> part but still it is throwing error,
    In flex3 we are making a component ex: <mx:canvas> and changeing that component to
    <cairngorm:ServiceLocator xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:cairngorm="com.adobe.cairngorm.business.*">
    </cairngorm:ServiceLocator>
    if any one used 4.5 with cairngorm let me know
    thanks

  • Adobe Muse: how to access HTML code inserted?

    Hi everyone,
    do you know how to edit HTML code already inserted in an Adobe Muse template?
    This code is for analytics purpose.
    Thanx
    fremo

    This forum is actually about the Cloud, not about using individual programs
    Once your program downloads and installs with no errors, you need the program forum
    If you start at the Forums Index http://forums.adobe.com/index.jspa
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says ALL FORUMS) to open the drop down list and scroll
    http://forums.adobe.com/community/muse for program questions

  • How to generate pwm pulse using NI DAQ in MATLAB

    hi everyone. please tell me how to generate pwm pulses using Ni DAQ card in MATLAB Simulink. if through coding is possible then post the corresponding code.....reply me 

    Make sure you have installed the Measurement studio support for VB 6.0 then you will be able to find examples in the folder below on win7 and 8.
    C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples
    Narrow down to Analog Output and choose update voltage example for measurement studio.
    You also have the possibility to use DAQ assistant if you have measurement studio installed. This function is a configuration type programming. After going through the configuration Wizard code is automatically scripted for you so that you can output the voltage you need. Read more about DAQ assistant in the blow link.
    http://www.ni.com/white-paper/4652/en/
    Best Regards
    Jonas Mäki
    Applications Engineering
    National Instruments

  • How to read HTML files using UTL_FILE

    Hello Friends,
    How to read HTML files using UTL_FILE package ? According
    to Oracle documentation UTL_FILE can read or write OS Text Files.
    Thanx in advance..
    Adi

    HI Hareesh,
    i have gone through that blog.
    i tried it...but i am getting mapping error  no receiver determination fond because there are so  many excel files.
    my data is available on sharedString.xml but also it is in not same order.
    i have no clue how to handle this part form the blog.
    "This way our mapping will receive all data from the sheet in an XML format. The only thing that's left is to create an XSD file from the XML file we received in order to be able to use it in the mapping and as our Service Interface and we can proceed with mapping. As you can see from the sheet.xml files all the data is placed with column name and row number so it's not that difficult to map it to an table type format using the Message Mapping only (no java, abap mapping required)."

  • How to generate addm report using grid

    Hi,
    how to generate addm report using grid, please provide any relevant doc/links etc.
    Thanks in advance.

    how to generate addm report using grid, please provide any relevant doc/links etc.When you start with the wrong question, no matter how good an answer you get, it won't matter very much.
    what is best way to divide board into 2 pieces using a hammer?
    Edited by: sb92075 on Oct 25, 2010 7:22 AM

  • Generate HTML code via JSP

    hi!
    I want to 'run' a JSP and then retrieve the generated HTML code.all without any browser/tomcat...
    is there a way to run JSP's in the virtual machine..?
    greetz
    chris

    we have some templates (generated with dreamweaver), there we want to fill in the dynamic content by java (JSP tags...)
    but in the end we don't have to show the html code on in the browser, we need a fix HTML file which we can print (the dynamic content filled in..)!
    any ideas
    chris

  • How I get started using voice input with mac mail?

    Just got a new Imac.  have had Apple computers for a long time.  Want to start using voice input with mail.  How do I get started?

    Apple's voice input options are the following:
    Dictation
    This allows you to speak a phrase and have the system enter it as text in any text field, be it a name and address form or a text editor like Pages or Word. The settings for this service are in the Dictation system preferences, and by default you activate it by pressing the Fn key twice in a row and then speak the desired phrase after you hear the bing sounds.
    Speakable Items
    This option allows you to somewhat control the Mac's interface elements by speaking key phrases to the system. This option is enabled in the Accessibility system preferences, and is at the bottom of the listed services. In here you can turn on the service and calibrate it to properly hear your voice, set a "listening key" (similar to the Fn key for Dictation), and then enable various command libraries.

  • How to find company code using sales doc. No

    Hi,
         I need to print company code, how to find company code using sales doc no. I don't find it VBAK.
    Cheers
    Senthil

    Dear Senthil
    You can find in table VBAK itself - Field BUKRS_VF
    thanks
    G. Lakshmipathi

  • How to generate multiple sheets using xml publisher

    Hi,
    how to generate multiple sheets using xml publisher.
    Thanks,
    Nur

    http://lmgtfy.com/?q=how+to+generate+multiple+sheets+using+xml+publisher

Maybe you are looking for

  • How to disable onboard video on KM4M-L?

    Does anybody know how to disable the onboard video card of the KM4M-L?  I tried just plugging in another AGP card, but it doesn't work.  I've gone through the bios, but can't find any reference to the onbard video. Another question I have is which ca

  • VisualAdmin: No Changes possible

    Hello. I want to setup a XI system. ABAP instance alread installed, client copy finished (client 100), Java Add-In installed (used DDIC @clnt 100 as RFC user). Now i want to to execute the steps mentioned on page 16 ff. of Installation Guide XI SR1 (

  • Project sites on project server not on PWA

    I am have created Projects and project sub sites on the Project Server however when I open up PWA I am unable to see the projects.  I am new to this and I am wondering if I need to make the projects as a part of a Team Site or what I am missing in or

  • IPod in disc mode error

    Hi folks: I'm having a problem that I've never encountered before. When I connect my click wheel iPod (4th gen, I think. Not color, 40gig but issued after that 4 button model) to my PowerBook, it doesn't show up as a disk like it was. If I go to syst

  • Disabling tokens in conc.pgm parameters

    Hi all, Kindly tell me how to disable a token in a concurrent program parameter. It says token is mandatory for oracle report parameters. Regards, SSK