java - Reading a properties file in Servlet -
To read the attribute file in my servlet using the code below I From my understanding, The parameter " Name "should be an" absolute "path for the file, so that it can open InputStream and its example can be found in the Properties.load (inputStream) method. Could be disturbed > This is clearly mentioned in the Java API. Please take a look at this: Hope it helps! getClass.getClassLoader () I would like to get clarity about GetResourceAsStream (...) line.
getClassLoader () will add class loader to the servlet class I have defined but how is it
propFileName ?
Properties is associated with PRO = new properties (); String profile name = "config.properties"; InputStream inputstream = getClass (). GetClassLoader (). GetResourceAsStream (propFileName); prop.load (InputStream); String User = Propetepti ("GOOGLE_CLIENT_ID"); String ID = Prop. Apt ("GOOGLE_REDIRECT_URL"); Public InputStream getResourceAsStream (string name)
Comments
Post a Comment