• 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

FacesMessage being displayed when the page is opened

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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-
 
Ranch Hand
Posts: 376
Scala Monad
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post the JSP/JSF and Java code you are using to display the message?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic