S
scooterJava
Gast
Anfänger: Mir gelingt es im Servlet nicht, korrekten Zugriff auf die Datei app.properties zu erhalten. Wie muss ich es richtig machen?
Auszug WEB.XML:
Auszug de.app.controllers.AppMain:
Ich erhalte eine FileNotFoundException.
Auszug WEB.XML:
Java:
<servlet>
<servlet-name>App</servlet-name>
<servlet-class>de.app.controllers.AppMain</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/config/app.properties</param-value>
</init-param>
</servlet>
Auszug de.app.controllers.AppMain:
Java:
public class AppMain extends HttpServlet {
Properties properties = new Properties();
@Override
public void init() throws ServletException {
try {
Reader reader = new FileReader(getServletConfig().getInitParameter("config"));
properties.load(reader);
} catch (Exception ex) {
// TODO
}
...
}
Ich erhalte eine FileNotFoundException.