• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Kick off localization in JSF

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my .jsp, I've got:



...and running the file I see


Caused by:
org.apache.jasper.el.JspPropertyNotFoundException - /login.jsp(22,8) '#{msg.catalog.title}' Property 'title' not found on type java.lang.String



Of course, I've got a file on the (Eclipse) path src/com/mydomain/catalog/messages.properties (as well as one in French). I also tried messages_en.properties (and using "messages_en" in place of "messages" in loadBundle), but to no avail. In those message files I've got:



In faces-config.xml I have:



Would someone explain the conceptual link between having messages, having an <application> tag in faces-config.xml and doing a loadBundle in the JSP? I'd like to figure this out, but so far, neither Google nor experimenting has helped. Or a link to someplace that explains.

Profuse thanks in advance,

Russ Bateman
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"#{msg.catalog.title}" is EL for "msg.getCatalog().getTitle()". Not what you want.

Without doing anything as intelligent as actually checking, I believe that the proper syntax is: "#{msg['catalog.title']}, since I'm pretty sure that "msg" is a map, and that's how you lookup map keys in EL.
 
Russell Bateman
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much. I had seen that construct here and there while Googling, but not understood what it was specifically for. One article in particular misled me into the syntax I chose. It seemed reasonable and I moved on puzzled as to why it wasn't working. I'm not certain how long it would have been before it dawned on me, so I thank you very much for this.

Russ
 
reply
    Bookmark Topic Watch Topic
  • New Topic