This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes ServletContext getResource(String path) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "ServletContext getResource(String path)" Watch "ServletContext getResource(String path)" New topic

ServletContext getResource(String path)

Zhiyong Sun

Joined: Nov 24, 2002
Posts: 4
The path MUST begin with a "/" and is interpreted as relative to the current context root. This is defined in the Servlet API.
However, I tested this funciton without "/" and it still works fine. Also, in the example code from that Minning Published SCWCD Study Kit, it also did not use "/".
Can anybody clarify this?
Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
Did you reload the class then after having changed and re-compiled?
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
It is well possible that some servlet engines are more lenient than the specification. Does it matter?
- Peter
I agree. Here's the link:
subject: ServletContext getResource(String path)
Similar Threads
problem in taglib
Scrabble... it only takes a minute...
Javac task and Javac path
Jarsigner tool