Where exactly does the path in Tomcat start?

I am trying to create a jsp page that outputs a random image. The jsp page is directly in ROOT. The image files are in ROOT/img/random/.
What I did was write a simple java class(not a servlet) to read the contents of random and then just randomly choose an image in that file. This class is in ROOT/WEB-INF/classes/com/utilities/, where the package is com.utilities.
My question is what is the proper path to the images so the java program can read its contents?
null

Thanks, but that really doesn't answer my question.Then ask your real question, because that's the right
answer.
I
need File to be able to access files under Tomcatand
no matter what path I try it can't read it.exists()
always returns false. I just need to know the path.I
will eventually move it out of ROOT, but theproblem
I am having will still exist in any other folder
under webapps.Wrong, wrong, wrong.Right, right, right. How do I know this? Because I tried it
>
I tried to put this outside of ROOT, but Tomcatwill
not automatically redirect to that page, using the
instructions at the Tomcat site for changing the
default start page. Neither does using a simplehtml
page to redirect.The correct way to access a file in a web context is
to use the servlet context and its
getResourceAsStream method. That way you can find it
as long as it's in the CLASSPATH. Put the file in
your WEB-INF/classes directory and you'll be able to
read it. It'll work in a WAR file or in exploded
mode. It's portable, too.This is wrong. I put that image file in classes, guess what? It still can't read the file!!!!
>

Similar Messages

  • SharedObject.flush - where exactly does it write the file

    SharedObject.flush method - where exactly does it write the
    file to and how
    this file is called?

    If it is not possible to command vie ActionScript where to
    store a shared
    object, is it possible to retreive a path to this object
    using ActionScript?
    "aa" <[email protected]> wrote in message
    news:eri01f$l5q$[email protected]..
    > SharedObject.flush method - where exactly does it write
    the file to and
    how
    > this file is called?
    >
    >
    >

  • What exactly does the MasterPageFile="~masterurl/default.master" in the page mean?

    Hi Everyone,
    I want to create a site definition that use my own master page in the homepage (VS2012 + SP2010). When the site definition is created, there are already codes in the default.aspx page that simply display a string in the body. And the page refers to a
    master page at ~masterurl/default.master.
    My question is, where exactly does ~masterurl point to? I want to use my own master page to replace it, but when I change it to any other location rather than
    ~masterurl/default.master, it gives me an error saying file not found.
    So could anyone tell me how can I use my own master page in the default.aspx page? I tryied to place my master page file in the LAYOUTS folder and refer to it using
    MasterPageFile="_layouts/site.master" but it does not work, either.
    Thanks in advance.
    Cavendish Feng

    Taken from http://msdn.microsoft.com/en-us/library/office/ms476046(v=office.12).aspx
    Dynamic token "~masterurl/default.master"
    This token references a master page from a content page by using the MasterPageFile attribute together with the value of the MasterUrl property.
    As an example, in the following page directive, <%@ Page MasterPageFile="~masterurl\default.master"%>, the token "~masterurl/default.master" is replaced at run time by the value in the MasterUrl property.
    This property contains the server-relative full path to the master page, including file name.
    Notice the article is talking about these dynamic tokens which are automatically substituted at runtime. Which is what you're seeing.
    Static tokens are explained here; http://rehmangul.wordpress.com/2009/12/15/master-pages-in-sharepoint/
    basically you have to be careful what path you're specifying, depending on the location of the page.
    w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | YouTube: http://www.youtube.com/user/JamieMcAllisterMVP

  • Where exactly is the 8i JVM?

    I installed iAS 1.0.1 for NT, and chose the standard edition. This supposedly means that I should have gotten the 8i JVM, among other things.
    But where exactly is the VM located? The only copy of java.exe that I can find within the Oracle directory is here:
    \oracle\ora81\apache\jdk\bin
    But that java.exe doesn't work. If I'm at a command prompt, and go to that directory and type:
    java -version
    then I get an error message about being unable to find jvm.dll.
    I do have a jvm.dll on my system, but it wasn't placed there by Oracle; it's in the Java 1.3 directory that I installed separately. Am I supposed to copy that DLL to the place where Oracle's apache\jdk\bin\java.exe is looking for it?
    Or did the Oracle installer fail to install jvm.dll?
    Or am I barking up the completely wrong tree, and should I be looking elsewhere for the 8i vm?
    null

    The 8i JVM is actually inside the database. You generally won't find a java.exe or jvm.dll which conforms to what you might come to expect when it's outside the database. In doing this, Oracle tried to make it more scalable (each Oracle session, for example, has it's own "virtual" JVM which starts at 4k and grows on demand).
    The iAS JVM, on the other hand, is more of what you'd consider a standard JVM. Going forward, there may be some things which iAS will support that the database JVM will not, as the database is really just for plain vanilla classes, rather than J2EE components.
    Hope this helps,
    -Dan
    http://www.compuware.com/products/numega/dbpartner/dbpordebug.htm
    Debug PL/SQL and Java in the Oracle Database

  • What exactly does the Radio Beacon Indicate

    I have seen cases where the Radio Beacon is black and when it is gray. When it's black you may or may not be able to go through the wireless router to the modem and then to the internet. When it is gray, you cannot really do anything except be in a local mode. However there are instances when the Radio Beacon is black, rather than gray, and you still cannot access the internet. So, what exactly does the activated Radio Beacon Indicate, i.e., that the wireless network is working and the modem is down, or something else entirely ?

    Assuming you're referring to the Airport icon in the menu bar, 'clear/empty' means Airport is turned off, gray bars means Airport is on but not connected to a network, and black bars means Airport is on and connected to a network. Other possible icon states are solid gray with a little computer inset, meaning you're connected to a computer-to-computer created on the Mac, and gray bars with an exclamation point (10.6 only), meaning connected to a network but not authenticated (e.g. wrong password for an 801.2X corporate/university network).
    To your question, it's perfectly possible to be successfully connected to a network (black icon) and unable to access the internet. Situations like that would include the network requiring a proxy server, for which you haven't set up the details on in Network Preferences, or you're connected to an open network that requires you to enter information or agree to terms (e.g. a hotel network, where you need to put in your room number and agree to the charges before you can connect to the internet).

  • What exactly does the global switch command line do ?

    Hello All
    Just foraging in the dark world of APP-V. I have a question which I cannot find answer for through google.
    There are powershell commands to publish an APP-V application globally. What exactly does the global switch do ?
    I understand it makes the application available to everyone on the machine for anyone who logs onto that machine.
    However in the absence of this global switch the application is still available to all users who logon to that particular machine. So what exactly is the reason for using the global switch ?
    Thanks

    Correct, the global switch makes the application accessable for all users logging on to that system.
    This feature is required for some packages, like Office. But it is ofter used for applications used by everyone, like Adobe Reader.
    However in the absence of this global switch the application is still available to all users who logon to that particular machine. So what exactly is the reason for using the global switch ?
    A package can be added to the system but until it is published a user cannot start it. They won't see any shortcuts in their startmenu/desktop/etc.
    So after you added the package to the system, it must be published to a user or globally (every user) to start it.

  • In Mac's PAINTR application, what exactly does the "Splash" function do?

    n Mac's PAINTR application, what exactly does the "Splash" function do?

    You might also post your question over in the Mac App Store section of the Community, where you might have a better chance of running into someone else using the Paintr App.
    Mac App Store: Apple Support Communities
    Dennis

  • Re: In Mac's PAINTR application, what exactly does the "Splash" function do?

    In Mac's PAINTR application, what exactly does the "Splash" function do?  It isn't mentioned in the Toolbox Documentation, but the "Splash" option is given right next to the "Draw" option at the top of the screen in the application itself.

    You might also post your question over in the Mac App Store section of the Community, where you might have a better chance of running into someone else using the Paintr App.
    Mac App Store: Apple Support Communities
    Dennis

  • Where exactly does your publication go?

    I've been thinking to download iBooks author from the mac app store. However I would like to know where exactly does your publication go when you upload it? I've tried looking on the bookstore and the magazine store (or whatever it's called), but I only seem to see publications from established authors.

    Mine shipped from the same place on May 19. I received it today in the USA. Yours should be there soon!
    -Bmer
    Mac Owners Support Group
    Join Us @ MacOSG.com
     An Apple User Group 
    ITMS: MacOSG Podcast

  • "Check Network Connection​" - What Exactly Does the TV Check?

    Hi everyone
    May I please ask, what exactly does the TV check when I choose "check network connection"?
    In other words, when I click the "check network connection", what IP address / servers and ports does it communicate to? What checks does it do?
    Because my TV cannot establish a network connection via settings, but the browser works perfectly well,
    I would like to carry out the same checks of "check network connection" on my PC.
    Then, if failed also on my PC, I would turn to my ISP with the results, as I believe it is the one to fault.

    Assuming you're referring to the Airport icon in the menu bar, 'clear/empty' means Airport is turned off, gray bars means Airport is on but not connected to a network, and black bars means Airport is on and connected to a network. Other possible icon states are solid gray with a little computer inset, meaning you're connected to a computer-to-computer created on the Mac, and gray bars with an exclamation point (10.6 only), meaning connected to a network but not authenticated (e.g. wrong password for an 801.2X corporate/university network).
    To your question, it's perfectly possible to be successfully connected to a network (black icon) and unable to access the internet. Situations like that would include the network requiring a proxy server, for which you haven't set up the details on in Network Preferences, or you're connected to an open network that requires you to enter information or agree to terms (e.g. a hotel network, where you need to put in your room number and agree to the charges before you can connect to the internet).

  • Where To give the path of file

    Hi,
    I am new to ODI,Here my source is a file,stored in my desktop.Please let me know where to set the path of my file in the physical schema.
    Thanks
    Anzeen

    Hi Anzeen,
    If its 10g u can use the default FILE_GENERIC data server which points to <ODI_HOME>/oracledi/demo/file
    If its 11g u need to create new DATA SERVER and PHYSICAL SCHEMA under FILE tech and in PHYSICAL SCHEMA in Directory (Schema) and Directory (Work Schema) u need to TYPE IN ur source file location which can be same.
    Ex:
    D:/SampleData
    Please note it the path would be separated by forward slash (/).
    Thanks,
    Guru

  • What "exactly" does the Brightness setting in Print do?

    What "exactly" does the Brightness setting in the Print module do?
    I know it's a controversial button, especially now that there are proofing options available. Also, since you're using it "blind" it's impossible to know how much or what it's really doing.
    Does anyone know if it's e.g.. the same as going to quick develop and going up on "exposure", or "brightness", or "shadows"... How exactly is it brightening the image, and is +100 a full stop or how is it calibrated?
    Thanks,
    Alan.

    Ooops,
    Obviously there is NO brightness control in LR...is the print adjustment similar to an exposure adjustment or more like moving the "shadows" and "whites" adjustments (which if I understand corrrectly, moves tones above or below mid tones, but not highlights or blacks)?

  • What exactly does the Work Offline option do in a shared review hosted on an internal server?

    Hi,
    What exactly does the Work Offline option do in a shared review hosted on an internal server?
    I *think* it simply disconnects you from the review server. I'm not sure why one would want to do this.
    I'm trying to recommend an offline workflow for reviewers who may not be able to access a shared review hosted on our internal server (for example, while traveling). These reviewers would like to be able to comment on an offline version of the review PDF and then publish their comments when they can again connect to the Internet/internal server.
    It doesn't seem like "Work Offline"  is the right fit for this scenario. Instead, should reviewers save a local copy to their hard drive, comment on it, and then, when reconnected to the Internet, open the local copy, click Reconnect to Server, and then click Publish Comments?

    Thanks, Dave. So for my hypothetical traveling reviewer, it would be reasonable to suggest the following steps for an offline workflow?
    1. Connect to the shared review.
    2. Choose Work Offline from the Server Status menu.
    3. Close and save the review PDF locally.
    4. Comment while traveling.
    5. When back in the office, open the local copy of the review PDF.
    6. Click Reconnect to Server.
    7. Click Publish Comments.

  • What exactly does the M7 coprocessor do in the iPad air, and what apps can use it?

    I've been trying a few 3rd party apps which use the m7 in the iPhone 5s. None of them work. Also there seem to be no apps both built in motion activity under the privacy menu in settings.
    My question is, what exactly does the M7 coprocessor in the ipad air?

    http://en.wikipedia.org/wiki/Apple_M7
    http://www.imore.com/apple-m7
    http://www.tuaw.com/2013/10/10/seven-apps-that-take-advantage-of-the-m7-motion-c oprocessor-in-t/

  • What exactly does the colaece option do in TOAD software

    Hi,
    What exactly does the colaece option do in TOAD software.
    Regards,
    MuruguPandian P

    Coalesce will take ADJACENT free space and coalesce it into one larger free chunk.
    A free extent in a dictionary-managed tablespace is made up of a collection of contiguous free blocks. When allocating new extents to a tablespace segment, the database uses the free extent closest in size to the required extent. In some cases, when segments are dropped, their extents are deallocated and marked as free, but adjacent free extents are not immediately recombined into larger free extents. The result is fragmentation that makes allocation of larger extents more difficult.
    You should often use the ALTER TABLESPACE ... COALESCE statement to manually coalesce any adjacent free extents. To Coalesce a tablespace give the following command
    SQL> alter tablespace ica coalesce;
    Source: http://www.oracle-dba-online.com/tablespaces_and_datafiles.htm
    Regards
    Asif Kabir

Maybe you are looking for