Opening a file inside my webapp

Hi all
I want to this method
XSLTransformer.doTransform(xml,new File("/templates/default/webpage.xsl"),new StreamResult(out));
opens the file webpage.xsl for a XSL processing. The file is in:
Web Pages -> templates/default/webpage.xsl (nb5)
but i can�t figure out how I make the reference, without using my local disk paths .
help?

Better to not use a File or path like that.
I'd recommend using the class loader
(getResourceAsStream from ServletContext) and put
that path in the CLASSPATH (e.g., under
WEB-INF/classes). Your app will be able to find it
relative to the context, which will stay the same if
you pick up your WAR file and move it from machine to
machine.ok, i will try that way
>
Do you read all the stylesheets in, compile the
transformations, and cache them on startup? Do all
that in an init() method for the servlet that uses
them. You'll only have to read and compile them
once that way - a big performance savings.
%Nope, no ideia how to do that. First time developing a webapp :)

Similar Messages

  • Opening html files inside jar

    Hi,
    I'm making a program where i have a set of help files in the form of html and i would like to open them when the user clicks the "Help" button and I used this code at first
    try
         Desktop.getDesktop().browse(new URI("resources/html/help.html"));
    catch (Exception ex)
         JOptionPane.showMessageDialog(null, "Could not open help.html in default browser\n", "Error", JOptionPane.ERROR_MESSAGE);
    }However after I made the jar and tried to execute on another computer however, it wouldn't work and would display the error message. I was wondering if there was some way that I could open the help.html in their default browser, or maybe a frame if that works, from the jar and have my program still be platform independent?

    ok so i just realized that it doesn't make sense for a program outside the jar, like IE or Firefox, to be able to access and open a file inside of the jar. I am now looking for suggestions on how to work around this problem for my program to be able to have a simple help system located inside the jar that can be loaded during runtime.
    Thanks for your suggestions.

  • Why can't i open PDF files inside of firefox without downloading them?

    None of the suggestions are working but i used to be able to do this. Please help!
    Thank you

    Did you check the action for opening Portable Document Format to make sure it is set to "Preview in Firefox"?
    *Firefox > Preferences > Applications
    *http://kb.mozillazine.org/File_types_and_download_actions
    *https://support.mozilla.org/kb/view-pdf-files-firefox-without-downloading-them

  • I can't able to open the *.log files from the firefox browser and i need to open the file inside the frame

    If i open the log file from firefox browser it is not open and throws an error as
    "The address wasn't understood
    Firefox doesn't know how to open this address, because one of the following protocols (e) isn't associated with any program or is not allowed in this context."

    What type of log file?
    What is the file name?
    What is the file path or URI?

  • How Can i open Html file in a Browser from Jar file

    Hi
    i am having Html help files inside my Jar file ... if i use
    getclass().getRource("\lib\start.html");
    it is not opening ... so i have to ship seperate folders for html files along with jar files.... can anyone give the solution to have(open) html files inside the jar file and to open then in a default browser of any OS
    Regards
    Ganesan S

    the follwing method i have used to open html file ...
    so to access html file i am shipping resources folder with jar file ..
    private void openHtmlPages(String pageName) {
         String cmd[] = new String[2];
         String browser = null;
         File file = null;
         if(System.getProperty("os.name").indexOf("Linux")>-1) {
              file = new File("/usr/bin/mozilla");
              if(!file.exists() ) {
              }else     {
                   browser = "mozilla";
         }else {
              browser = "<path of iexplore>";
         cmd[0] = browser;
         File files = new File("");
         String metaData = "/resources/Help/Files/"+pageName+".html"; // folder inside jar file
         java.net.URL url = this.getClass().getResource(metaData);
         String fileName = url.getFile();
         fileName = fileName.replaceAll("file:/","");
         fileName = fileName.replaceAll("%2520"," ");
         fileName = fileName.replaceAll("%20"," ");
         fileName = fileName.replaceAll("jarfilename.jar!"," ").trim();
         cmd[1] = fileName;     
         try{
              Process p = Runtime.getRuntime().exec(cmd);
         }catch(java.io.IOException io){
                   //Ignore
    can anyone give me the solution..???
    Regards
    Ganesan S

  • How do I open .wim files on my macbook pro?

    When my hard drive crashed for the second time on my HP computer, I knew it was time for a change. The HP help menue gave me the option to backup everything onto an external hard drive. I did this and now when I try to open the files inside, they are all "#.wim" files. The #s go from 0.wim-53.wim. How do I open these files? Some might be microsoft word or powerpoint files but I have not got Microsoft word for mac yet. I understand that this will probably prevent me from opening some of the files but wouldnt I be able to open the others? If you know anything about ".wim" files, please help me.

    https://en.wikipedia.org/wiki/Windows_Imaging_Format
    http://www.eigenlogik.com/entropy/

  • Open a File in a JTextPane via Drag and Drop

    Hi,
         I have a simple JTextPane in a Swing App on Windows XP. I would like to know if it is possible for me to be able to add the functionality such that I can drag a text file to the JTextPane and it would open the file inside the Pane. Is this possible? If yes then how do I implement it? (I am not insisting on the app working on non-Win XP systems � so portability is not a concern.)
         I have tried to search for the drag and drop stuff but I am confused. First, which interfaces should I implement i.e. DragGestureListener, DragSourceListener, DropTargetListener or what?
         I would be grateful for any pointers.
    Thanks a lot,
    O.O.

    1. http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html - This link did have the information but has since been updated and no longer points to the relevant information that I have since used.
    So you where given a link with the appropriate informaton, but Sun has changed the information and you are blaming us for not helping? Unbelievable!
    Here is a link to the old tutorial:
    https://www.cs.auckland.ac.nz/references/java/java1.5/tutorial/uiswing/dnd/intro.html#importFiles
    Now tell us how that does not do exactly what you wanted?
    I really don�t know why some people waste their time here just providing you with linksBecause most people like yourself don't know how to ask a question. DnD is a complex topic. The only way to learn it is to read a tutorial and experiment. What a better way to learn than to play with a working example. You are given many working examples in the tutorial.
    You did not state wihich example you had changed. You did not state what problems you where having.
    The best you could state was "I'm confused". You where asked to clarify your problem/confusion but didn't. We are not mind readers so we couldn't provide further help.
    I agree I am wasting my time helping someone who doesn't even appreciate the effort made by the many individuals of the forum and I won't make that mistake again.

  • Opening HTML files

    Hi there,
    I'd love someone giving me a bit of help about this...
    AFAIK, Nokia S40 phones can't open an html file stored locally (in the phone's memory or memory card), although they can if that file is accessed through an internet connection.
    So... is there a method or piece of software that I could use to open HTML files stored locally? (I've tried some Java browsers, including Opera Mini, but they all seem only fit for online browsing).
    Thanks a lot,
    Marcos

    ok so i just realized that it doesn't make sense for a program outside the jar, like IE or Firefox, to be able to access and open a file inside of the jar. I am now looking for suggestions on how to work around this problem for my program to be able to have a simple help system located inside the jar that can be loaded during runtime.
    Thanks for your suggestions.

  • Adobe Reader could not open 'A9R8EF5.tmp' inside of an air application

    Hello,
    I am getting this error after updated acrobat reader to 11.0.10, when i try to open pdf files inside of an adobe air application.
    Adobe Reader could not open 'A9R8EF5.tmp' because it is either not a supported file type or because the file has been damaged.
    But if i go directly to the file locations I can open them with acrobat.
    How this can be fixed?
    But the files exist.
    Thanks

    Hello  Mr. Raja,
    If I may take your time. I have problem something like this.
    There is application called GME in which user entered project estimation(GME) on EP Portal. It is Customization Application. A program where anyone can download the complete project estimation in PDF file. Program is working fine in MMD(portal and R/3) but not working in MMQ(portal and
    R/3).(PDF file is not getting opened when click 'Download')
    Please find the reply from Application developer
    "I am fetching data from R/3 database from Webdynpro Module Tcode(SE80)
    application name ZPS_WD_GME ,and stored into a workarea and passing that workarea to smartform application ZPS_SF_GME_DOWNLOAD.Then calling function SSFCOMP_PDF_PREVIEW it will export all data and that all data will convert into pdf through Convert_OTF function module .After the completion of above steps calling method cl_wd_runtime_services=>attach_file_to_response use for downloading the pdf file."
    Please help us since this is to go Live

  • Can I access my backup files inside the airport using finder?

    When I tried to open some files inside the airport extreme appear this message:
    The alias “Documents” can’t be opened because the original item can’t be found.
    Someone know how to open this file? I didnt lose any file, I just want to open using AirPort.
    Thanks

    It's recommended NOT to use your AirPort Extreme for backups Mainly because the Time Machine software was not deigned to work with the AirPort Extreme and the Extreme wasn't designed to work with Time Machine. That's why Apple has the Time Capsule, for wireless backups.
    Try connecting your hard drive directly to your computer.

  • Open an html file inside spry collapsible panel

    Greetings,
    Using CS5
    Does anyone know the CSS code/possibility of opening an html file inside the Spry panel?
    I've tried the following code:
    .CollapsiblePanelContent {
        background-image: url(lookoutgraph.html);
    Is there a better CSS element for calling up an html file?
    For what it's worth...the html file I'm tring to open uses a <canvas> tag. When opened by itself, the html file has no problem opening and displaying the canvas data.
    Much Thanks!

    With the exeption of images, to add external content to a document you will need to make use of either serverside or clientside code.
    Have a look at the SpryHTMLPanel here http://labs.adobe.com/technologies/spry/samples/htmlpanel/html_panel_sample.html
    Otherwise, please supply a link to your site so that we can come up with alternatives.
    Gramps

  • Is it possible to open up an excel file inside a Web Browser not IE?

    I'm trying to find out if it is possible to open up a pivot excel file inside the a web browser, but i don't want to use Internet Explorer for that i'd prefer firefox for that.
    I have a web application that uses an excel file for one of its reports but i don't want the user to have to download the file in order to view the report and that particular report has various ordering criteria so i don't want any of the funtionality of the file to be lost in the process, so is it possible to do it? what tools would help me acomplish that?

    I don't think this is possible.
    You may be able to make it display in Firefox if the file is defined as the XML Excel format and not the xls or xlsx formats. But that would require saving the file differently and you would most likely loose all/most functionality
    You may find some Excel translators in Java (most notably POI from Apache). But they would still require you to adapt them to web format and you would have to duplicate much of the Excel functionality yourself. So it would be a long term option.
    You could check out Google Docs. They have a spreadsheet application that I believe can convert Excel files to their format. You may be able to use it inside your web site with permissions.

  • To open a Excel and Doc file inside the AIR application

    How to open a Excel and Doc file inside the AIR application.  I have opened the PDF file inside the AIR application.  But i got stuck in opening the Exce and Doc file.  Please help me in this issue.

    AIR does not support this inherently. However, you could write code to parse these file formats. For example, the following is an ActionScript 3.0 library for reading and writing Excel files:
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1375018

  • How to open a .par file inside NWDS

    hi all,
    please help me out I want to open a .par file inside NWDS and make change the theame.
    thanks & regards

    Hi Jitender,
    Please try and do the customisation of teh Login page using this Document:
    <b><a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/ep/_a-c/customizing%20the%20logon%20user%20interface%20of%20sap%20enterprise%20portal%206.0">Customise the Login Page</a></b>
    Also try the how-to guide:
    <b>http://service.sap.com/epinstall -> SAP Enterprise Portal 6.0 -> Documentation and More -> How-To Guides -> How to Customize the Logon Screen</b>
    I hope this helps you..
    Regards
    Pravesh

  • UNABLE TO OPEN AN HYPERLINK INSIDE OF A WEB PDF FILE OPENED INSIDE OF IE 11

    Hello, We have gone to the website
    http://www.salonrenovationmaisonneuve.com/en/exposants
    and download the file to open Inside of IE. Once the file is open, none of the links either e-mail or web site works. However, if we open the same file Inside of Google Chrome, the links work. So, we want to know if we are missing something in IE or a plugin.
    The PDF file opens with no problem but the links are not enabled. The file works in an Apple Machine and Google Chrome. However, if we download the file physically inside of the computer and then open the file with Adobe Reader, the links all work! Any ideas
    how to solve this issue? Thanks Miguel Moreno
    Miguel A. Moreno Alfa Logos inc. Tel. 514-253-2548

    Any ideas how to solve this issue?
    Try using Protected Mode Off.  Then you will be at the same level of security that those other programs are running at.  You could also try elevating the iexplore.exe task.  That would turn off Protected Mode in that task automatically but then
    you would be running also with Administrator level authority which might be excessive.
    Robert Aldwinckle

Maybe you are looking for

  • Function Module not working through VC

    Hi Experts I am facing one strange issue while working on VC model with function module as data service. This FM is to writes data to bcak end BI master data table which is working fine through BI. When i pass the values through VC, New values are no

  • Directory path not working in CS6

    I have an extension that I am updating for Dreamweaver CS6. Here's the link on Adobe: http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=2430523 The gist is during install it provides the user with the option select a custom

  • Can anyone give a brief intro and sample of how to use semaphore & it concept

    Thanks.

  • Stateless Business Rule not realy stateless

    Hi all, I build a process using BPEL 11 where I used some stateless business rules but when there are some situation where I call the BR with diferent parameters and I receive the previuos response (I'm already usisng the staless output parameters).

  • Unable to set up EasyLock in Sony flash drive.

    I am trying to run EasyLock in my Sony flash drive, USM64GU, but I keep getting the error prompt: "Please copy EasyLock in the root of your Micro Vault and run it from there". I have already copied the EasyLock into my flash drive. Can anyone help me