| Author |
FacesMessage being displayed when the page is opened
|
Daniel Conner
Ranch Hand
Joined: Jan 25, 2007
Posts: 47
|
|
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
Joined: May 26, 2007
Posts: 375
|
|
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)
|
Gabriel
Software Surgeon
|
 |
Tak Ng
Greenhorn
Joined: Jun 05, 2007
Posts: 19
|
|
|
Can you post the JSP/JSF and Java code you are using to display the message?
|
 |
 |
|
|
subject: FacesMessage being displayed when the page is opened
|
|
|