It was said that the parameter "path" of the getResourceAsStream(String path) of ServletContext should be specified according to the rules given in getResource in the J2EE API Specification. The specification said that the path of the getResource must begin with a "/" and is interpreted as relative to the current context root.
I wrote two servlet classes and found that the path of getResource must be started with "/" as description, but the path of the getResourceAsStream could be started without "/" either.
It run suceessfully.
So I wonder whether the path of the getResourceAsStream coule be started without "/". If it could be that, what is it mean? Which directory is the path interpreted?
posted 12 years ago
Is there somebody who could answer it? It puzzled me for several days. Thanks!