• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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!!!
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic