• 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

How do I use message bundles from my backing bean

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a backing been which extends AbstractPageBean.
I want to output a message from the bundle

e.g.
this.info("message fro m bundle");

How do I do this?

Thanks

Jag
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jag Bains wrote:Hi
I have a backing been which extends AbstractPageBean.

Makes no sense to me. It is not part of Sun JSF API. What library are you talking about? Are you using some visual editor which autogenerates some code heap for you? If so, do you actually understand that code in terms that you´re perfectly able to write it all yourself? If not, I would recommend to stop using the visual editor for a while and write JSF code yourself until you´ve a good grasp on JSF.

I want to output a message from the bundle

e.g.
this.info("message fro m bundle");

How do I do this?


Use ResourceBundle API to load the desired message bundle.
Use FacesContext#addMessage() to add a new FacesMessage to the context.
 
Jag Bains
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I should have mentioned that I am using Netbeans 6.5

My JSF page is (login.jsp):



I have a webuijsf:messageGroup id="messageGroup1" on the page and I want to populate it with a message from the page bean login.java as follows:


In my loginBtn_action, I want to display a message that is displayed in messageGroup1.
What should I do to display a message from the resource bundle?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Netbeans is just an IDE.

As said, use ResourceBundle API to load the desired message bundle and use FacesContext#addMessage() to add a new FacesMessage to the context.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic