Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting properties form harddisk and use those in jsp's

 
Rakesh Basani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I am using some properties in jsp page. I want that properties to be loaded from .property file which is in hard disk (not in classpath).
ResourceBundleMessageSource not allowing me to refer .property files from hard disk.
Is there any other class which can do that work for me... (loading .property file from hard disk and allows me to use those in .jsp's using <fmt:message.../>)

Its urgent guys, please reply...

Thanks in advance,
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
 
Rakesh Basani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you quick reply Bill..

I tried with it, but its not working at all...





 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah you can't use ResourceBundleMessageSource. It uses the JDK's ResourceBundle API, which supports classpath resources only. You need to use ReloadableResourceBundleMessageSource instead, which does support any Spring resource location for its basename (including plain file paths and explicit "file:..." URLs.
 
Rakesh Basani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill..

But still have a problem. I want to use sytem property in value tag of ReloadableResourceBundleMessageSource. How can I use that..
When I give direct path like "file:E:/users/iuct", its working fine..
But when I use "file:${xyz}/iuct",its not working properly..

Here xyz is a system property.. configured in pom..


Thanks in advance..
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a PropertyPlaceholderConfigurer configured that is reading in your pom.properties file?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic