joi, 9 aprilie 2015

5 Quick Tips for JSF Page Authors

1. Do something if this is a postback request:
 <h:outputText rendered="#{facesContext.postback}" value="OK!"/> 

2. Do something if this is a postback request and validation didn't failed:
 <h:outputText rendered="#{facesContext.postback and not facesContext.validationFailed}" value="OK!" />

3. Do something only if this is an AJAX request:
 <h:outputText rendered="#{facesContext.partialViewContext.ajaxRequest}" value="OK!"/>   

4. Do something only if there are no messages to display (any kind of JSF messages):
 <h:outputText rendered="#{facesContext.messageList.size() eq 0}" value="OK!">   

5. Do something only if the current user is in the specified role:
 <h:outputText rendered="#{facesContext.externalContext.isUserInRole('some_role')}" value="OK!"/>      

Niciun comentariu:

Trimiteți un comentariu