■
Q.
WebLogic は配備した WAR ファイルを展開しないため、 WebLogic で同じ WAR ファイルを配備する場合は、結果は異なり、 ServletContext の getRealPath() メソッドは null を返します。では、この環境で、プロパティファイル/テンプレート/スタイルシート/Servlet/ビルドプロセスは、どのように扱えばよいのでしょうか?
A.
web.xml
...
...
properties
/WEB-INF/velocity.properties
protected Properties loadConfiguration (ServletConfig config) throws IOException, FileNotFoundException {
String propsFile = config.getInitParameter(INIT_PROPS_KEY);
Properties p = new Properties();if ( propsFile != null ) {
InputStream iStream = getServletContext().getResourceAsStream( propsFile );if ( iStream != null ) {
p.load( iStream );
}
}return p;
}