This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Spring and the fly likes getting properties form harddisk and use those in jsp's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "getting properties form harddisk and use those in jsp Watch "getting properties form harddisk and use those in jsp New topic
Author

getting properties form harddisk and use those in jsp's

Rakesh Basani
Ranch Hand

Joined: Jun 04, 2012
Posts: 38
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

Joined: Mar 07, 2010
Posts: 1648
    
    7

use the file: prefix.

see the resource documentation.

http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/resources.html#resources-resourceloader


[How To Ask Questions][Read before you PM me]
Rakesh Basani
Ranch Hand

Joined: Jun 04, 2012
Posts: 38
Thanks for you quick reply Bill..

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





Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1648
    
    7

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

Joined: Jun 04, 2012
Posts: 38
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

Joined: Mar 07, 2010
Posts: 1648
    
    7

Do you have a PropertyPlaceholderConfigurer configured that is reading in your pom.properties file?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: getting properties form harddisk and use those in jsp's
 
Similar Threads
Help this kid to now how to run JSP in Weblogic server 5.1
Problem with properties file
about image processing
EL functions in FACELETS...
How to read Advanced properties of wmv file