• Post Reply Bookmark Topic Watch Topic
  • New Topic

Equivalent of System.getProperty in JSP  RSS feed

 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to retrieve the property existing in a.properties in the JSP file. How to do it? In the Servlet, i am able to retrieve it by using System.getProperty but i dont know how to do in JSP file. Any help is appreciated.
regards
sudha
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the <fmt:message> action of the JSTL.
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,
The properties file is not part of the application(.EAR file). Hence i am unable to use fmt:message.
regards
sudha
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could retrieve it in a Servlet using getResourceAsStream with the file on the classpath, the pass it to the JSP
 
Stefan Evans
Bartender
Posts: 1836
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
me == confused

What does System.getProperty (which the OP said he was using) have to do with Resource bundles and properties files?
[ October 10, 2007: Message edited by: Stefan Evans ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stefan Evans:
What does System.getProperty (which the OP said he was using) have to do with Resource bundles and properties files?
Doh! You're right!

I just saw proprties file and assumed that the OP wanted to retrieve bundle values.

As Roseanne Roseannadanna would say: never mind.
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to retrieve the property outside of the application in the JSP.Currently i am retrieving the property in the action class by using System.property. Can i do the same thing in JSP.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way to perform this action in a JSP without resorting to scriplets. Retrieving such values in your action and passing them to the JSP as scoped variables is actually the best means to do this.

If you absolutely must get these values from a scriptless JSP, you could investigate writting an EL function or a custom tag to perform the fetch.
[ October 11, 2007: Message edited by: Bear Bibeault ]
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot for the info
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!