.properties file in Tomcat 4.1

HiWhere to include a properties fil for a web application.SP
[81 byte] By [suuryana] at [2007-10-2 5:36:34]
# 1
Put the properties file uder WEB-INF/classes. use the getClass().getResourceAsStream("/propertyFile.props") method to locate the properties file. Create an instance of Properties and use its load(InputStream) method.
tolmanka at 2007-7-16 1:47:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

"Put the properties file uder WEB-INF/classes. use the getClass().getResourceAsStream("/propertyFile.props") method to locate the properties file. Create an instance of Properties and use its load(InputStream) method"

Let me know where to use this getClass method, as a java class or use in jsp declaration. I dont want use java class for this. I want use include directive or jsp declaration?

Can you give snippet of the code for declaration?

SP

suuryana at 2007-7-16 1:47:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

<!%

private static Properties props = new Properties();

public void jspInit() {

props.load(this.getClass().getResourceAsStream("/propertyFile.props") );

}

%>

http://www.fawcette.com/javapro/2002_02/online/online_eprods/servlets_bkurniawan2_5/default_pf.aspx

tolmanka at 2007-7-16 1:47:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
I am getting this error.unreported exception java.io.IOException; must be caught or declared to be thrownprops.load(this.getClass().getResourceAsStream("/topic.properties") ); SP
suuryana at 2007-7-16 1:47:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

You should know how to catch exceptions in java.

try{

props.load(this.getClass().getResourceAsStream("/topic.properties") );

} catch(IOException e){

e.printStackTrace();

}

Rahul.Guptaa at 2007-7-16 1:47:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...