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 property value in jsp page from application.properties 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 property value in jsp page from application.properties " Watch "getting property value in jsp page from application.properties " New topic
Author

getting property value in jsp page from application.properties

Mukhi Vla
Ranch Hand

Joined: Apr 22, 2010
Posts: 50
i am trying to get property value from application.properties file. I tried giving the following command



But in oputput i am getting it as ???propname1???

Can any one suggest me how to get property value in jsp using JSTL?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Did you bind the bundle? Look though the other tags in the JSTL fmt set for more information.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mukhi Vla
Ranch Hand

Joined: Apr 22, 2010
Posts: 50
I am using Spring framework. I have the application.properties file loaded in the following way in applicationContext.xml file.


so it is not resourcebundle properties file. How ever i would like to know how to bundle this properties file?
Mukhi Vla
Ranch Hand

Joined: Apr 22, 2010
Posts: 50


The above is working fine. but i want to get ten property values in nearly 50 jsp pages. I am looking for some other way where i can bind this bundle at only one place.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Read the JSTL specification on this issue. As I recall, you can bind the bundle to application context and have it available everywhere.
Mukhi Vla
Ranch Hand

Joined: Apr 22, 2010
Posts: 50
I got it. In applicationContext.xml file.

I set the follwoing bean definition. and its working



Where application value refers to my application.properties file
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: getting property value in jsp page from application.properties
 
Similar Threads
problem with .properties file
How to get selected value from struts dropdown list?
Retrive a property from a .properties file to JSP custom tag
Using messages in resource bundle in tiles-def.xml
placing propertie file in .war file