• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to access properties file

 
Gerome Kawa
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I need to use a properties file to replace variables in a Java program and a servlet.

Eg. of Java program:
****************************************************

****************************************************
The servlet:

********************************************************************
I want to put the stuff between @xyz@ in the above programs in a properties file and access them - how do i do it?

I want to stuff @xyz@ in the servlet to come from a init-param of the servlet defined in web.xml .

Question:
Where should I put the properties file ?
How do i access it(the variavles in the properties file) from java program?
Do i need to put the properties file in the classpath?

Thanks
Kawa

[EDIT code tags added by Dave]
[ February 10, 2005: Message edited by: David O'Meara ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://wiki.apache.org/jakarta-tomcat/HowTo

Third item on the page. It should answer all of your questions.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a pointer for you: SimpleDateFormat isn't thread safe! It should be but is not.

Don't make it a static final, create a new one each time you need it, or as a method variable (NOT an instance variable, this is a servlet we're talking about).

Just be glad you're not learning this the hard way!
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and after 56 posts it's time for you to experiment with UBB's code tags
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic