Can't use relative paths in jsp pages or javabeans

Hi everyone,
Can someone please help me with this little problem.
When I want to use in a JSP page the object 'FileReadInput' to read in a file, it can't find when I only give the filename. The target file and source file are in the same directory so I would expect if I only give the filename, it will automatically search in the current directory. But when I give the complete absolute path, everything works fine. Is it possible to use relative paths in a jsp or javabean file?
By the way, I am working with JDeveloper from Oracle. (maybe that has something to do with my problem)
Can someone help me???
Thx

My dear friend,
It will not work at all. coz, for any jsp file, ur application server will create a .java file and then .class file in a directory other than the directory where ur .jsp file present. that's why, ur file to be read can't be found. that's why use the following.
String path=getServletConfig().getServletContext().getRealPath("/")+File.seperator+"yourfilename";

Similar Messages

  • Can any one suggest me how can I use relative path inside SSIS pacakge to access config file ?

    Can any one suggest me how can I use relative path inside SSIS pacakge to access config file ? Please help me as its urgent.THanks for your help in advance.

    Hi Jay,
    SSIS can only recognize the absolute path of a XML Configuration file, the relative path is not supported. Furthermore, if the XML Configuration file is already generated, we can use the Environment variable package configuration type instead so that
    SSIS runtime automatically looks for the configuration file from the path defined in the environment variable. This is convenient when we need to deploy a package to different environment. We only need to define the environment variable for package configurations
    once on each server, and then the variable can be used by all the packages on this server.
    Regards,
    Mike Yin
    TechNet Community Support

  • Problem with include and relative path in jsp

    Precompile jsp with wlappc in 9.2, I got the error "The include file was not found" when the jsp use <%@ include file="../includes/dataEntry/code_error.html" %>
              This code used to work with 8.1. I notice that someone has report the same problem with 9.0 and you have patch for it. Is it fix in 9.2 or do I require a patch as well?
              Thanks,
              Khuemy

    When you precompile, can you say "Keepgenerated=TRUE". It might help you track
              down the difference with the URL. You should only get a 404 error when the
              resource is not found at runtime, which is independant of when you compile. The
              difference should be in how the URL is compiled.
              Chris
              ali wrote:
              > I am using WLS 6.0 SP1, when I use relative path in <jsp:forward> in my JSPs
              > it forwards ok if I am using directly JSPs but if I am using pre-compiled
              > JSPs (and have proper servlet-mappings
              > in my web.xml), I get 404 error with the relative-path, if I change it to
              > absolute path with pre-compiled JSPs it forwards ok , then.
              > any ideas why this is so?
              > thanks,
              

  • Using Relative Path instead of Full Path OMBPlus

    Can we use relative paths in OMBPlus scripts instead of full paths. For example all my OMBplus (tcl) scripts are in folder;
    C:\tfsroot2\Interfaces and Extracts\branches\Interfaces and Extracts1.1\000 - OWB Prototype\deploy\ora.stg
    and the MDX file I would like to deploy is in
    C:\tfsroot2\Interfaces and Extracts\branches\Interfaces and Extracts1.1\000 - OWB Prototype\deploy\ora.stg\scripts\dwextract\tables
    but when I try to use
    OMBIMPORT MDL_FILE '../scripts/dwextract/tables/$tblName.mdx'
    instead of
    OMBIMPORT MDL_FILE 'C:/tfsroot2/Interfaces and Extracts/branches/Interfaces and Extracts1.1/000 - OWB Prototype/deploy/ora.stg/scripts/dwextract/tables/$tblName.mdx'
    It does not work.
    I use
    call "C:\OraHome_1\owb\bin\win32\OMBPlus.bat" "C:\tfsroot2\Interfaces and Extracts\branches\Interfaces and Extracts1.1\000 - OWB Prototype\deploy\ora.stg\OMB_DEPLOY_TBL.tcl" XTRCT_WRK_INPUT_FILE
    in order to execute.
    I think it is because It set the OMBPlus.bat location is a base folder. Any way to overcome this issue and use relative paths instead of the full path?

    OK, a couple of things. First, you need to remember that TCL treats back-slashes as an escape character. Always use forward slashes in your paths, or double up the back slashes .
    So, this should work:
    CD "C:\tfsroot2\Interfaces and Extracts\branches\Interfaces and Extracts1.1\000 - OWB Prototype\deploy\ora.stg"
    call OMBPlus.bat "C:\\tfsroot2\\Interfaces and Extracts\\branches\\Interfaces and Extracts1.1\\000 - OWB Prototype\\deploy\\ora.stg\\OMB_DEPLOY_TBL.tcl" XTRCT_WRK_INPUT_FILEor this:
    CD "C\tfsroot2\Interfaces and Extracts\branches\Interfaces and Extracts1.1\000 - OWB Prototype\deploy\ora.stg"
    call OMBPlus.bat "C:/tfsroot2/Interfaces and Extracts/branches/Interfaces and Extracts1.1/000 - OWB Prototype/deploy/ora.stg/OMB_DEPLOY_TBL.tcl" XTRCT_WRK_INPUT_FILEAs an FYI for OMB, if you are prone to doing a lot of scripts and so building libraries of common functions, you can also easilly use the "file" command in order to determine the current directory at runtime so you can plunk your script anywhere with it's required libraries and it will be able to source them at runtime.
    For example, all our scripts have this basic bit of code at the beginning so we can pass them between developers and it doesn't matter where anyone put their script directory - the scripts will find the libraries as long as they are co-located:
    #  Get Current Directory and time
    set dtstmp     [ clock format [clock seconds] -format {%Y%m%d_%H%M}]
    set scrpt      [ file split [file root [info script]]]
    set scriptDir  [ file dirname [info script]]
    set scriptName [ lindex $scrpt [expr [llength $scrpt]-1]]
    set cnfg_lib "$scriptDir/ombplus_config.tcl"
    set owb_lib  "$scriptDir/omb_library.tcl"
    set sql_lib  "$scriptDir/omb_sql_library.tcl"
    #  Import Lbraries
    #      Assumes that owb_config, omb_library, and omb_sql_library are in the same directory as this
    #      script.
    #get config file
    if [catch { set retstr [ source $cnfg_lib ] } errmsg] {
       puts "**********************************************************************"
       puts "* Libraries are missing from the current directory. Exiting.... *"
       puts "**********************************************************************"
       return -code 2
    #get standard library
    source $owb_lib
    source $sql_lib
    #  Set Logfile
    #    This will overwrite anything set in the config file.
    set LOG_PATH "$scriptDir/logs"
    file mkdir $LOG_PATH
    set    SPOOLFILE  ""
    append SPOOLFILE $LOG_PATH "/log_"  $scriptName "_" $tabName "_" $dtstmp ".txt"
    # Now the main script body goes from here.Cheers,
    Mike
    Edited by: zeppo on Aug 4, 2009 7:02 AM
    Edited by: zeppo on Aug 4, 2009 7:03 AM

  • How to read/know/use  relative paths in java files ?

    I am able to access files in java after using the
    String TxtURL = "file:///c:/files/TEXTS/";and then loop
    = new File(ma.TxtURL +filename );However , I need to use this in several drives , C , D E etc , how can I use relative path ?
    I used these but they didn't work
    String TxtURL = "file:///TEXTS/";
    String TxtURL = "file:////TEXTS/";
    String TxtURL = "file:///./TEXTS/";
    String TxtURL = "file:///../TEXTS/";

    ya batch , I want to run a java program from batch file
    java C:\...\fileand as u know that C will change , so any suggestions/solutions ?
    thanks

  • Ive just learned that i can use loadjava to load jsp pages into the database.

    Ive just learned that i can use loadjava to load jsp pages into the database. How is that possible. How can someone go to my lets say, index.jsp page and actually see it if its inside the database? What authenticates it? Where would you set the parameters to tell http(apache) to look inside the db for the pages?
    Any ideas?

    Thanks for the reply. If I put the file on the database, does it have to be in a particular location? I've put it on the database server, launched sql*plus (as APPS) and ran the following:
    execute dbms_java.loadjava('-v', 'ZebraGetPrinterFromXML.class');
    PL/SQL procedure successfully completed.Then when I try to run a process that uses this I get this:
    ORA-29540: class ZebraGetPrinterFromXML does not exist

  • Oepe-12.1.2.1-kepler how to use ADF Templates in JSP page

    Hi all,
        I use oepe 12.1.2.1 kepler 4.3 and creating JSP page but I can't see any ADF Rich Faces Page in JSP Templates Page of Preferences Dialog. How to use ADF Templates in JSP page?
    Thanks,
    Thomas

    Select the JSP Templates link. Is the ADF Rich Faces Page template listed? Refer Creating the Login Page/4.
    Introduction to the Oracle Enterprise Pack for Eclipse (OEPE) IDE

  • How to use relative paths in Captivate 8 / Cómo usar URL's relativas en Captivate 8

    Hello, I have developed a bunch of courses which will be migrated to a new site and I am having trouble changing the absolute paths into relative URL's to resources such as PDF files inserted into the scorm packages. I cannot find information on how to use relative paths in Captivate. Please help. Thank you.

    I have the same issue with relative links using Captivate 8.  I am trying to load Captivate modules into an LMS using relative links to document files within the LMS.  The links work fine during a site page test so not an issue in the LMS, but from the Captivate module they aren't working....
    Help?

  • How can I write relative path in File, ImageIcon objects

    I have downloaded examples from
    http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/index.html
    but for some reason images are invisible until I write absolute paths?(I use windows) How can I write relative path in File, ImageIcon objects?

    Hello;
    I've found a lot of complaints about this through the Forte forum as well as on Dejanews. I'm just curious as to whether any of you ended up finding a solution to this problem.
    There was one posting about setting up the subdirectory as a URL rather than a String and then using that as the source of the ImageIcon ... but this didn't work for me.
    Any help whatsoever would be appreciated.
    Thanks!

  • Can I use preview to export multiple page PDF as jpegs?

    Using Preview, I export multiple page PDF as jpeg and results are the first page only as jpeg. Can I use preview to export multiple page PDF as jpeg for every page?

    Automator is great for this if you need to export many pages to JPG, or just have to do this often.
    Two other quick and dirty way sto get it done:
    (1) Enable thumbnail view, click on the ONE PAGE you want to convert to jpg, then choose "export." If you choose more than one page, only the first will get exported to jpg.
    (2) Create a copy of the file, delete all the pages except the one you want to export to JPG, and export that page. You may be able to "undo" the delete, get all your pages back again, and re-delete all but the one you want to export, etc. I would not recommend doing this on the original version of the file because of Preview's autosave so-called "feature."

  • Before you can perform print-related tasks such as page setup - Internet Explorer 8

    I understand there have been similar threads on this but they all related to printing directly out of Acrobat reader rather than a browser.
    On some machines when printing a PDF from within Internet Explorer the error "before you can perform print-related tasks such as page setup" is displayed and users are unable to print. I have removed printers, changed the default printer none of which have worked. If you change Acrobat reader to not display PDFs in Internet Explorer printing works fine.
    System Information
    Windows 7 Enterprise
    Acrobat Reader 9.3.0
    Internet Explorer 8
    Any information regarding this would be appreciated.
    Cheers
    Jason

    This works in Photoshop cs4: SOLUTION!!! I get the same msg... "before you can perform..." etc. on some images that I've printed before but not on others. I haven't found the cause, but here's an easy WORKAROUND: Open your file, Select All, Copy, File>new, paste... and print away!!!

  • Using threads in a jsp page

    I would like to know wether any one had used threads in a jsp page
    like one thread gets the data from database while other shows some text saying "getting data from database"
    Thank you

    "getting data from database" is not a valid message
    to give. You might think it's interesting, but the
    people using your application don't give a damn about
    you fetching something from the database.
    The basic rule is: people are stupid, don't give them
    any reason to be confused.Funny stuff, Ill remember that :-)

  • Why cant I use relative paths in Netbeans

    Why cant I use relative paths in Netbeans to files on my PC.
    I want to be able to copy my project folder between different drives and pcs dont want to edit the code everytime I do.
    BTW I didnt know where on the forum to post this. Just in case this is the wrong place.

    When I use relative paths it doesnt see the files. Like when I want to add an image to a panel. If I use '../image.jpg' it wont work but if I use 'd:\javafiles\images\image.jpg\ it will work.
    Cant seem to fix it.

  • Menu using relative paths

    Hi, I have flash menu all using relative paths to the html
    files. I also have some files in a separate folder for
    organization. I add the folder paths to get to the html files
    within the folder, but when I get into that folders file, i cant
    get back out. If I add ../ to the other files, it of course brings
    me out, but cant get to the other files. I hope that makes sense,
    Should I just use absolute paths?
    file.html
    /folder/file.html
    otherfile.html
    thanks,
    Josh

    absolute would probably work best.
    When a link brings you into a folder (/folder/file.html), if
    the same set of links is there and you click a link that is
    supposed to bring you to home (index.html), it tries to open
    (/folder/index.html), not index.html. Make sense?
    Thanks,
    Josh

  • Can't print: "Before you can perform print-related tasks such as page setup or printing a document,

    Hello,
    I have searched these forums but have not found a solution to my problem.
    I recently purchased an IOGear USB Print Server (print server only, not USB device server). I was having issues installing and followed a Microsoft support document to try and resolve the issue. It had me remove some entries from the registry.
    Hours later, I was able to get the printer installed and working, but I do not know if it was a result of the registry tweak. But now that it has been installed, I cannot get anything to print from Acrobat Reader (I have tried 7.0 and 8.1.1). I get the following error message:
    "Before you can perform print-related tasks such as page setup or printing a document, you need to install a printer."
    Is there something I should check in the registry to make sure that it will work? I do know for sure that it was working when it was just the printer and drivers installed, it only happened after running the print server setup. I have already tried removing the printers and drivers from the system.
    Thanks,
    Braden

    I have a problem similar to those posted here, with one difference. With my printers newly installed, regardless of which one is selected as the default, when I try to print from Adobe Reader I receive the error message we're talking about : "Before you can perform a print related task...."
    Here's the fun part.
    If I click OK on the message, ALL MY PRINTERS GET DELETED and, I get the windows message that "Spooler subsystem app has encountered a problem and needs to close"! If instead of clicking OK I switch to Task Manager and end Adobe, I'm fine and can print from other programs.
    I can "reset" the problem by deleting the files in C:\Windows\System32\Spool\Printers and C:\Windows\System32\Spool\Drivers\w32x86, restarting the machine, and deleting then reinstalling the printers (which show up again after the restart).
    BUT, if I try to print from Adobe Reader again, I get the same cycle of problems.
    I am running Windows Vista and Adobe Reader 8.1

Maybe you are looking for