This content has been marked as final.
Show 14 replies
-
1. Re: How to get ResourceBundle message from backend using Sea
gavin.king Mar 23, 2007 6:15 PM (in response to xigua)@In Map messages;
or
@In ResourceBundle resourceBundle; -
2. Re: How to get ResourceBundle message from backend using Sea
pmuir Mar 23, 2007 6:15 PM (in response to xigua)You are probably after the Messages component (which you access in JSF as #{messages[key]}).
You could do Messages.instance().get(key) or @In(#{messages[key]} String value or @In Map<String, Object> messages; -
3. Re: How to get ResourceBundle message from backend using Sea
xigua Mar 23, 2007 6:16 PM (in response to xigua)Another question I have is, is there any way to use a dynamic keyname in the front end?
For exmaple:
#{messages[#{keyController.keyname}]} ? -
4. Re: How to get ResourceBundle message from backend using Sea
gavin.king Mar 23, 2007 6:18 PM (in response to xigua)Did you try the obvious, ie:
#{messages[keyController.keyname]} -
5. Re: How to get ResourceBundle message from backend using Sea
xigua Mar 23, 2007 6:19 PM (in response to xigua)"gavin.king@jboss.com" wrote:
@In Map messages;
or
@In ResourceBundle resourceBundle;
I tried this actually
@In
private ResourceBundle resourceBundle;
then resourceBundle.getBundle().getBundle("editFlight").getString("planeName");
But I got NPE at runtime and it turned out resourceBundle is null. -
6. Re: How to get ResourceBundle message from backend using Sea
xigua Mar 23, 2007 6:20 PM (in response to xigua)"gavin.king@jboss.com" wrote:
Did you try the obvious, ie:
#{messages[keyController.keyname]}
I have not, just thought about it while posting this topic. :) Will do...
Thanks -
7. Re: How to get ResourceBundle message from backend using Sea
gavin.king Mar 23, 2007 6:21 PM (in response to xigua)nonononono!
@In java.util.ResourceBundle resourceBundle; -
8. Re: How to get ResourceBundle message from backend using Sea
xigua Mar 23, 2007 6:24 PM (in response to xigua)"petemuir" wrote:
You are probably after the Messages component (which you access in JSF as #{messages[key]}).
You could do Messages.instance().get(key) or @In(#{messages[key]} String value or @In Map<String, Object> messages;
For the front end, I specify the view-id in pages.xml such as
<page view-id="/scheduler/editFlightInfo.xhtml" bundle="scheduler/editFlightInfo"/>
Then I have a editFlightInfo_en.properties under WEB-INF/classes/scheduler
then on editFlightInfo.xhtml, I can do things like "#{messages.keyname}" where the keyName is in editFlightInfo_en.properties.
However, how Seam know which view-id I am referring to (or which resource bundle file) from the java side? -
9. Re: How to get ResourceBundle message from backend using Sea
xigua Mar 23, 2007 6:25 PM (in response to xigua)"gavin.king@jboss.com" wrote:
nonononono!
@In java.util.ResourceBundle resourceBundle;
Oops! I will try it tonight.
Thanks a lot Gavin. Have a nice weekend -
10. Re: How to get ResourceBundle message from backend using Sea
xigua Mar 26, 2007 11:13 PM (in response to xigua)"xigua" wrote:
"gavin.king@jboss.com" wrote:
nonononono!
@In java.util.ResourceBundle resourceBundle;
Oops! I will try it tonight.
Thanks a lot Gavin. Have a nice weekend
This worked. I was able to call resourceBundle.getBundle("flight/editFlight").getString("keyname") -
11. Re: How to get ResourceBundle message from backend using Sea
xigua Mar 26, 2007 11:14 PM (in response to xigua)"xigua" wrote:
"gavin.king@jboss.com" wrote:
Did you try the obvious, ie:
#{messages[keyController.keyname]}
I have not, just thought about it while posting this topic. :) Will do...
Thanks
doesn't seem to work. :( -
12. Re: How to get ResourceBundle message from backend using Sea
gavin.king Mar 26, 2007 11:26 PM (in response to xigua)doesn't seem to work. :(
And what happens? Stack trace? -
13. Re: How to get ResourceBundle message from backend using Sea
matsgekberg Jan 9, 2008 9:09 AM (in response to xigua)"gavin.king@jboss.com" wrote:
nonononono!
@In java.util.ResourceBundle resourceBundle;
I tried this and I get the bundle but the locale is "". Why is that?
I have declared bundles like this:<core:resource-loader> <core:bundle-names> <value>i8n.common.common_messages</value> <value>i8n.usecase1.usecase1_messages</value> </core:bundle-names> </core:resource-loader>
-
14. Re: How to get ResourceBundle message from backend using Sea
pmuir Jan 9, 2008 7:43 PM (in response to xigua)Ancient thread, please start a new one.