вы не можете установить значение из файла Properties
, но вы можете установить файл свойств и прочитать его во время выполнения.
<context-param>
<param-name>propfile</param-name>
<param-value>myproject.properties</param-value>
</context-param>
, а затем прочитать файл свойств во время выполнения.
MyServlet myServlet = new MyServlet();
Properties properties = new Properties();
// get the properties file name
String propfile = myServlet.getInitParameter("propfile");
// load the file
properties.load(getClass().getClassLoader().getResourceAsStream(propfile));
// get the desire properties
Object propName = properties.get("my.computer");
// out.println(propName.toString());
надеюсь, это поможет и другим.