It looks to me you can use "#{not empty facesContext.messages}" in this
case.Walter Mourão http://waltermourao.com.br http://arcadian.com.br http://oriens.com.br On Mon, Feb 16, 2009 at 6:18 AM, Simon Kitching <[email protected]>wrote: > Madhav Bhargava schrieb: > > Hi All, > > > > > > > > I have a requirement wherein I have to disable UI components based on > > whether there are any error messages in the Message Queue (t:messages). > > > > facesContext is an implicit object so I thought of using it like - > > #{facesContext.getMessages.hasNext} However when it was not working > > because you can only specify properties of a class and JSF variable and > > property resolver will then internally try and call the getter/setter of > > that property. > > > > > > > > I find that rather limiting because I do not find the need to define a > > class level property when all I need is to process and output a Boolean. > > Is there any way apart from overriding the > > PropertyResolver/VariableResolver? > > No, EL does not allow "method calls". It only allows reading/writing > properties. > > However isn't this enough for what you want to do? > > You could create a simple class: > public class MessageChecker { > public boolean isMessagePresent() { > return FacesContext.currentInstance().getMessages().hasNext(); > } > } > > Then register this class as an app-scope managed bean. > > JSF components can then do > disabled="#{messageChecker.messagePresent}" > > Yes this means creating a trivial class, and having an instance of it in > memory in order to call a static method from the JSF components. This > could be considered ugly. But on the other hand, the JSF pages are now > much better isolated from the details of the implementation. > > Regards, > Simon > -- > -- Emails in "mixed" posting style will be ignored > -- (http://en.wikipedia.org/wiki/Posting_style) >

