Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Resource bundle properties file in Spring MVC

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I am trying to configure the Resource Bundle properties file in Spring MVC with no succcess.
I am using Tomcat on Eclipse IDE. In my xml file i tried this:


and tried creating a messages.properties file under my build/classes , under WEB-INF and under various places but when i try to load a message through
im always getting this ???greeting??? (not finding the message)
Any suggestions please cos I am quite new to Spring MVC
thanks lots
Rina
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try under WEB-INF/classes ? And what it the name of your property file ?
 
Ranch Hand
Posts: 227
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I assume 'fmt' means JSTL taglib with URI as 'http://java.sun.com/jsp/jstl/fmt'.

JSTL is independent of Spring MVC, and hence, a resource-bundle loaded via Spring MVC can not be directly referred using JSTL. You can use 'fmt' taglib to load the resource-bundle also, in which case 'fmt:message' will work.

However, I would recommend replacing

with

where 'spring' prefix is for Spring MVC taglib with URI as 'http://www.springframework.org/tags'.

A resource-bundle loaded via Spring MVC can easily be accessed using Spring MVC taglibs.

Another point... for simplicity, consider changing

to

in the configuration.

Best regards,

- Aditya Jha
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<fmt:message key="greeting"/> tag will work. when you update your messages in a messagebundle.

Stop your server and restart or redeploy your project.

???......??? will go away and show the real message
 
What are you doing? You are supposed to be reading this tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!