About the reading of documents in Tomcat

zhaozj2021-02-16  56

Here (http://nagoya.apache.org/wiki/apachewiki.cgi?tomcat/howto) found the following solution

How do i load a proties file?

Here Are 2 MOPULAR WAYS:

1) Use a ResourceBundle. See the java docs for the specifics of how the ResourceBundle class works. Using this method, the properties file must go into the WEB-INF / classes directory or in a jar file contained in the WEB-INF / lib Directory.

2) another

// Assuming that you are in a Servlet extending HttpServlet? // This will look for a file called "/more/cowbell.properties" relative // ​​to your servlet Root Context InputStream is = getServletContext? (). GetResourceAsStream? ( "/ More / cowbell.properties "); Properties P = new Properties (); p.Load (IS); is.close ();

转载请注明原文地址:https://www.9cbs.com/read-17843.html

New Post(0)