This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to inject FacesContext into Message-driven bean?  RSS feed

 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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!!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!