Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FacesMessage being displayed when the page is opened  RSS feed

 
Daniel Conner
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a web app that I am currently developing that has a table where data is loaded into from a database. In the list accessor method, the database is queried and the list is populated IF the user has privileges. However, if the user doesn't have privileges then I need a FacesMessage displayed when the page is opened. I already implemented this... The list isn't populated when an unauthorized user tries to access the page.(Which is part of what I want...) However, the message isn't displayed when the page is opened. But, if I open the page again after initially opening it... the message will be displayed.. I have tried a few different things.. I have tried context.renderResponse(). I tried explicitly refreshing the page after adding my message... of course, they didnt work. Any ideas on how to force the message to be displayed? Awesome. Thank you for your help.

-Daniel-
 
Gabriel Claramunt
Ranch Hand
Posts: 375
Monad Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just guessing, but probably the page is evaluated before you put the message.
Maybe is easier have something like:
<h:panelSomething rendered="#{!accessControl.userHasAccess}" >
You don't have
</h:panelSomething>
<h:panelSomething rendered="#{accessControl.userHasAccess}" >
... display the list...
</h:panelSomething>

(forgive me if I have small notation details, is been a while since I used JSF last time)
 
Tak Ng
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the JSP/JSF and Java code you are using to display the message?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!