Working in Servlets/JSP, you might have encountered The javax.servlet.ServletContext API. It provides methods to access resources in general. getResource(String resource): will returns a URL for the resource in the web application.getResourceAsStream(String resource): will returns an InpuStream for the resource in the web applicationgetResourcePaths(String path): will a directory-like listing of all the paths to resources within the web application.
The file named web.xml is part of your web applications. You may use it for different purpose. Sometimes you wish to define some parameters for your web application in it. Obviously, you need to use this in your application. I will briefly tell you how to do this.
At first, let me give you an example. We have a web application that needs to send its id and license code to some authentication server before doing some business operation. The id and license code are static and you may
Updated 05-24-2011 at 01:34 PM by Java Tip