• 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 to inject FacesContext into Message-driven bean?

 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

I want to develop one interesting project. Two people are able to exchange with messages via Java Message Service.
Unfortunately I cannot anyway resolve one problem. I want to display message on JSF page as soon as it is arrived.
For that I suppose I need FacesContext instance in MDB. Unfortunatelly all methods I have tried to inject FacesContext failed.
1. FacesContext.getCurrentInstance() doesn't work
2. @Inject FacesContext fc; ----- doesn't work
3. I tried to make my mdb also a managed bean by @ManagedBean annotation and then inject FacesContext via @ManagedProperty(value="#{facesContext}") but this doesn't work too.

Can anybody tell me what to do to display arrived message immediately on JSF page?

My opinion is to use FacesContext and then look up needed UIComponent via facesContext.getViewRoot().findComponent("responseForm:responseText");

Thank you!
 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

I have left this stupid idea to inject FacesContext without even starting the container!

I understand that I can display arrived message on page whenever it comes using attribute 'binding'. I tried it and unfortunately method UIOutput.setValue doesn't work.
I don't know why. There is also method UIOutput.setValueExpression but I don't know how to use it.

Please, can anybody tell me how to display message on jsf page when it is consumed by method MessageListener.onMessage(...) immediately without reloading the page.
Is it right to use attribute 'binding'?

Thank you very much for help!!!
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic