File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Kick off localization in JSF

 
Russell Bateman
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic