• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Create dynamic text in jsf  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I know how to create dynamic text with facescontext.addMessage();
But i have to do that without facescontext. Can anyone show me the tricks ?
So in page B when i press a button, the text show up.
and when i go to page A( jsf page ) via commanlink  and go back to page B i should not see the text show up anymore. I need to press the button again to show up the text


Thanks
 
Bartender
Posts: 20125
103
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not understand what you want.

The messages component of FacesContext is primarily for the benefit of JSF's built-in validation mechanism and other JSF internal uses. Each message can, in fact, attach itself to a particular form control, which means that you design pages either to present messages in a block or have each message proximate to the form control whose value was reported invalid. It's not a general-purpose text display system.

The FacesContext doesn't even exist except when the FacesServlet is in control for a request/response cycle. Pass to a JSP or non-JSF servlet, and FacesContext isn't available. Likewise the messages are associated with the current request and no other, since it's assumed that the user will be repairing whatever problem was reported and that the next response may well have an entirely new set of messages. Or none at all.

If you simply want a message, make it a property of a backing bean and use h:outputText to display it. You can also just code a raw EL expression if you don't want the message to be a JSF structured component (with styles, styleClasses, element ID, and the right to be considered as an independent element in a JSF tabular control.

And to ensure that your message doesn't promptly evaporate, make sure that the backing bean in question is not in request scope. Request scope is virtually useless in JSF, anyhow.
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!