This content has been marked as final.
Show 6 replies
-
1. Re: How to get message from resource bundle in WebRemote
cash1981 Nov 4, 2009 9:21 AM (in response to cash1981)And yes, I know it should be
Messages.instance().get("thisDoesntWork");
-
2. Re: How to get message from resource bundle in WebRemote
shane.bryzak Nov 4, 2009 3:06 PM (in response to cash1981)It works for me -
@WebRemote public String getMessage(String key) { return Messages.instance().get(key); }
<script type="text/javascript"> function getMessage(key) { var callback = function(message) { alert(message); } Seam.Component.getInstance("messageAction").getMessage(key, callback); } </script> <a href="#" onclick="getMessage(prompt('message key'))">Get message</a>
-
3. Re: How to get message from resource bundle in WebRemote
cash1981 Nov 4, 2009 3:48 PM (in response to cash1981)This is really strange. Then there must be something with the settings? Because I copy/pasted your code and still just got what I sent through param.
In our message bundle, we have:
test=This is a test
@WebRemote public void fromJavascript() { String test = Messages.instance().get("test"); //returns test (same as parameter) }
Calling the same thing within normal Java
public void normalJava() { String test = Messages.instance().get("test"); //returns "This is a test" }
How can this be then? Do we need to add something in components.xml or similar?
-
4. Re: How to get message from resource bundle in WebRemote
shane.bryzak Nov 5, 2009 12:28 AM (in response to cash1981)I don't think so - I just tested it with a seam-gen generated project.
-
5. Re: How to get message from resource bundle in WebRemote
cash1981 Nov 5, 2009 10:22 AM (in response to cash1981)Finally I found out why it didn't work.
We are using localized version of message bundle configured in faces-config.xml
<application> <locale-config> <default-locale>no</default-locale> <supported-locale>no</supported-locale> </locale-config> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> </application>
It seems WebRemote goes against the default en version. How can I configure WebRemote to use my locale version?
-
6. Re: How to get message from resource bundle in WebRemote
cash1981 Nov 10, 2009 2:21 PM (in response to cash1981)I found this jira on the same issue