One line of code references the resource file

xiaoxiao2021-03-06  42

I didn't know if there is such a class. The reference to the resource file is written by yourself: java.util.resourceBundle.getBundle ("COM / FRAME / WebFrame / Portal). GetString (" RequisitionAction.Optical ") ResourceBundle is an abstract class GetBundle is a factory method, which is the relative path where the resource file is located, which is relative to the classes folder, or use com.frame.webframe.portal, this remember. This method returns a ResourceBundle object, then through its real case, enter the key in Key-Value, thereby obtaining Value

Method 2:

Properties P = new Properties (); InputStream i = thread.currentthread (). GetContextClassLoader (). GetResourceAsStream ("COM / Archermind / WEP / IT / Outer / Seq.Properties"); P.LOAD (i);

or

Property.Load (New FileInputStream ("com.mysave.properties"); path is also relative to the Classes folder, you can test it.

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

New Post(0)