This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

In JSP,how i will read the link from properties file.  RSS feed

 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
In JSP,how i will read the link from properties file
and display that page when i click the link.


for example:-
x.properties file which contains
TermsLink=http://tcs028949:99/help/Terms.html

In jsp file how i call the x.properties file and in the jsp page when i click Terms it will display the content of Terms.html data.

Could you please guide me for the needful?

Thanks and Regards
Sumanta Panda
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the property in the page controller for the JSP and send the value to the JSP as a request-scoped variable.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or use the JSTL's fmt taglib.
 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir,
I agreed.But Could you please guide me how to start this thing in technically.I am a beginner in Jsp programming.Please
i request you to all guide me in technically how to resolve it.

Thanks a lot in Advance.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google the word "ResourceBundle" . it is used to read the properties file
[ December 23, 2008: Message edited by: seetharaman venkatasamy ]
 
sagar gangipamula
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sumanta panda:
Dear Sir,
I agreed.But Could you please guide me how to start this thing in technically.I am a beginner in Jsp programming.Please
i request you to all guide me in technically how to resolve it.

Thanks a lot in Advance.


Hi ..

U can use


<% ResourceBundle rb = ResourceBundle.getBundle("com.bean.messages");

String displayImage = rb.getString("displayImage");
%>



where messages is properties file (messages.properties)

and com.bean.messages is complete path of that file.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSTL's fmt taglib does exactly that in a modern scriptletless manner.

Keep your JSP free from scriptlets.
 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot to all of you whoese advise helped me a lot to understand the concept.

Special thanks to Sagar.

Regards
Sumanta Panda
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!