How do I check if there is an error message?

WIth
<h:message for="something"/>
I can display the (error) message for "something".
How do I check if there is a error message fomr "something" in a JSF page?
I am asking cause I want to use an other styleClass for an h:inputText field.
Can there be something like:
<h:inputText styleClass="${messages.something.error ? errorstyle : normalstyle} ...
Thnaks for any answers

Here you can find the code of my solution to the question.
Hope it can be useful...
Note: The existence of the nested class the names of the attributes
have been chosen only to make the Faces JSP more "human readable"...
in the faces-config.xml
<managed-bean>
  <managed-bean-name>decorate</managed-bean-name>
  <managed-bean-class>package.Decorate</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
</managed-bean>
at the end of your jsp page (as last component in the page)
<h:inputHidden value="#{decorate.inputs.onerror}" />
the "decorator"
public class Decorate {
     * @return Returns the inputs.
    public Input getInputs() {
        return new Input();
     * @param inputs
     *            The inputs to set.
    public void setInputs(Input inputs) {
    public class Input {
         * Decorates all the components of the Faces JSP that have at least one
         * associated message.
        public String getOnerror() {
            FacesContext context = FacesContext.getCurrentInstance();
            UIComponent root = context.getViewRoot();
            decorate(context, root);
            return "";
         * Decorates the specify components and all its children recursively.
         * @param context
         *            the current <code>FacesContext.</code>
         * @param node
         *            the component to decorate.
        private void decorate(FacesContext context, UIComponent node) {
            Iterator it = context.getMessages(node.getClientId(context));
            if (it.hasNext()) {
                try {
                    Method getStyleClass = node.getClass().getMethod(
                            "getStyleClass", new Class[] {});
                    String style = (String) getStyleClass.invoke(node,
                            new Object[] {});
                    style = (style != null) ? style + " message" : "message";
                    Method setStyleClass = node.getClass().getMethod(
                            "setStyleClass", new Class[] { String.class });
                    setStyleClass.invoke(node, new Object[] { style });
                } catch (Exception e) {
                    e.printStackTrace();
            for (Iterator iter = node.getChildren().iterator(); iter.hasNext();) {
                decorate(context, (UIComponent) iter.next());
         * This method has been exposed only to comply to the <i>JavaBeans
         * architecture </i>.
         * @param onerror
        public void setOnerror(String onerror) {
how it works:
The core of the class is the decorate(FacesContext, UIComponent) method:
for each component on the current view I simply test whether the component
has got a setStyleClass method, therefore I don't care about the actual
components library! It can be tomahawk, standard JSF, whatever! and
I don't need to create my own components
( or to extend all existing components!)
only to manage the task of the "on error stlye class".
If all the "stylable" components had implemented an interface, it would have
been better, but its not like that therefore this is the only way I could think of.
Any idea would be appreciated.
Then, if there exists a message associated to the component, I simply
extend its style class adding the CSS style class message.

Similar Messages

  • I'm trying to burn a dvd from idvd but I keep getting error message, broken assets, but when I check my drop zones and their content there's no error messages on any of them?

    I'm trying to burn a dvd from idvd but I keep getting error message, broken assets, but when I check my drop zones and their content there's no error messages on any of them?

    Hi
    And if You change view - in main "window/view field" so that You see the box-plot structure.
    No exclamation marks there either ?
    and non at the front page ?
    iDVD do not copy Your material - only points to where it is stored. So if on any external hard disks, USB-memories, CDs or DVDs are missing - assetts are broken.
    Or if You changed location of any material or directed iPhoto or iTunes or GarageBand to a new Library - Then iMovie/iDVD also get's lost.
    Yours Bengt W

  • HT1338 I have clicked in the App Store icon and when I have attempted to download there is an error message. Saying I need to connect to the UK store, not the US store, how do I do this?

    I have clicked in the App Store icon and when I have attempted to download there is an error message. Saying I need to connect to the UK store, not the US store, how do I do this?

    Switching an iTunes Store account to a different country
    http://www.ilounge.com/index.php/articles/comments/switching-an-itunes-store-acc ount-to-a-different-country/
     Cheers, Tom

  • When I am trying to burn my playlist, there is an error message that says "cd/dvd software not found"  How do I fix this?

    When I am trying to burn my playlist, there is an error message that says "cd/dvd software not found"  I can burn in windows media but not itunes.  I have tried to uninstall and reinstall itunes but it still does not work.  Please help!!

    I ran the diagnostics check and this is the message:
    Microsoft Windows Vista Home Basic Edition Service Pack 2 (Build 6002)
    Dell Inc. Inspiron 1525
    iTunes 10.7.0.21
    QuickTime 7.7.3
    FairPlay 2.2.19
    Apple Application Support 2.3
    iPod Updater Library 10.0d2
    CD Driver 2.2.3.0
    CD Driver DLL 2.1.3.1
    Apple Mobile Device 6.0.0.59
    Apple Mobile Device Driver 1.57.0.0
    Bonjour 3.0.0.10 (333.10)
    Gracenote SDK 1.9.6.502
    Gracenote MusicID 1.9.6.115
    Gracenote Submit 1.9.6.143
    Gracenote DSP 1.9.6.45
    iTunes Serial Number 00C4AB4403487290
    Current user is not an administrator.
    The current local date and time is 2012-12-05 23:52:38.
    iTunes is not running in safe mode.
    WebKit accelerated compositing is enabled.
    HDCP is not supported.
    Core Media is supported.
    Video Display Information
    Intel Corporation, Mobile Intel(R) 965 Express Chipset Family
    Intel Corporation, Mobile Intel(R) 965 Express Chipset Family
    **** External Plug-ins Information ****
    No external plug-ins installed.
    The driver AFS.SYS is installed on the system.
    iPodService 10.7.0.21 is currently running.
    iTunesHelper 10.7.0.21 is currently running.
    Apple Mobile Device service 3.3.0.0 is currently running.

  • I use Safari on a Windows XP os.  Suddenly I cannot access my email and there are no error messages to indicate why.  How do I troubleshoot this?

    I have been using safari on a pretty old Dell with Windows XP.  I use it mainly to access email on google.  Suddenly I cannot get into my emails and there
    are no error messages.  How should I troubleshoot this problem?  Also, safari is an older version - should I upgrade it?

    Safari for Windows was discontinued a long time ago. It has bugs that will never be fixed, and it should no longer be used.

  • I must re-install HDD, when tried to install application DVD with iPhoto,there was a error message, could not instal it again, I have LION 10.7.3. How can install application DVD again?

    I must re-install HDD, but when tried to install application DVD with iPhoto,there was a error message, could not instal it again,
    I have LION 10.7.3.
    How can install application DVD again?
    thanks
    Dimitar

    I've asked the hosts to move this post to Lion.
    Here is a better place for you Lion posts.
    https://discussions.apple.com/community/mac_os/mac_os_x_v10.7_lion?view=discussi ons
    What is HDD?
    How to install most applications from DVD.
    Place dvd in dvd drive.
    Double click on dvd image if a folder didn't appear.
    Double click on application icon in drive folder.
    follow instructions.
    Robert

  • I had a problem installing icloud on windows 8.1. What should I do? At the end of the installation process there is a error message.

    I had a problem installing icloud on windows 8.1. At the end of the installation process there is a error message.What should I do? 

    I'm guessing that you have checked and complied with the system requirements?
    System Requirements
    Microsoft Windows 7 or 8
    Microsoft Outlook 2007 or later or an up-to-date browser (for Mail, Contacts, Calendars)
    Internet Explorer 9 or later, Firefox 22 or later, or Google Chrome 28 or later (for Bookmarks)
    Broadband Internet access
    Note: If you are upgrading from iCloud Control Panel 1.1 or earlier, you will need to sign out of iCloud Control Panel and uninstall it before downloading iCloud Control Panel 3.1

  • Firefox won't start, there is no error message and it is not already running.

    Hi,
    When I try to click on firefox, the little wait icon appears and then disappears. Nothing opens, not even safe mode. I've looked at the "Firefox won't start and there is no error message" help section and looked at my task manager processes. It seems that when I click firefox, it briefly appears on my processes and then disappears. This happened yesterday while I was in the middle of using it. At the same time, my Skype also crashed, which makes me think the two are correlated. The two programs still don't work. The only way that I can open firefox is if I install it all over again with the "launch firefox now" option checked at the end. When I have a firefox window open, I can open other firefox windows just fine. When I close it, nothing opens. Thanks for your help.

    1) Start Task Manager
    2) Open Processes (make the description area large enough to see)
    3) look for a description that says ''firefox''
    4) Select it and press End Process
    '''Now Firefox should work properly.'''

  • How do I open safari after quit unexpectedly error message?

    How do I open safari after quit unexpectedly error message?

    Force quit Safari if required, then reopen while holding the Shift key.
    Check the links below for options to remove the Adware
    http://www.adwaremedic.com/index.php
    Remove unwanted adware that displays pop-up ads and graphics on your Mac - Apple Support

  • There is the error message when we run IR8A report

    Hi SAP expert,
    There is the error message when we run IR8A report via T-code PC00_M25_NCT8A, below is the error message
    "Assignment to valuation model is missing for calculation process 25 SGLS
    Message no. HRSEN00107
    Diagnosis
    There is no entry in the assignment table for valuation model and rounding rule (V_T525S) for the return value  for feature SENOR on the key date 07.12.2007 for the selected calculation process 25 SGLS (country grouping, calculation process, process step).
    At least one valuation model must be assigned to each calculation process in view V_T525S.
    Procedure
    Make an entry for this calculation process and return value for feature SENOR in view V_T525S (Assignment of Valuation Model and Rounding Rule).
    I would appreciate you very much if you could advise me how to solve this problem.

    Hi ,
    I am facing the same error like this,
    please let how did you solve this iisue ?
    thakn\s

  • Why isn't my iMessage on my Mac working? I'm not able to log in-there's a error message.

    why isn't my iMessage on my Mac working? I'm not able to log in…there's a error message.

    Place the iOS device in recovery mode with one of thes programs and then restore via iTunes
    For PC
    RecBoot: Easy Way to Put iPhone into Recovery Mode
    If necessary:
    Download QTMLClient.dll & iTunesMobileDevice.dll for RecBoot
    For MAC or PC       
    The Firmware Umbrella - TinyUmbrella
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up     
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:

  • My Ipod classic works perfectly until there's around 3 GB loaded on it, then there is an error message saying that it couldn't sync because of an unknown error.

    My itunes and Ipod software are both the current version, doesn't seem to change anything. It works perfectly until there's around 3 GB loaded on it, then there is an error message saying that it couldn't sync because of an unknown error.

    Hey joshuafromisr,
    If you resintall iTunes, it should fix the issue. The following document will go over how to remove iTunes fully and then reinstall. Depending on what version of Windows you're running you'll either follow the directions here:
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    http://support.apple.com/kb/HT1925
    or here:
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    http://support.apple.com/kb/HT1923
    Best,
    David

  • Itunes wont open. Ive tried uninstalling, cleaned up my PC and then re installed again but still wont open! There are no error messages. It just wont open

    Itunes wont open. Ive tried uninstalling, cleaned up my PC and then re installed again but still wont open! There are no error messages. It just wont open! Im very frustrated and anything would help! I have Windows 7 or Vista. Idk which

    Hello Dr.Help,
    Thank you for providing so much information about the issue you are experiencing with iTunes.  It sounds like you have tried reinstalling it, but nothing happens when you launch it.  I recommend following the steps in this article to resolve launch issues with iTunes:
    iTunes for Windows Vista or Windows 7: Troubleshooting unexpected quits, freezes, or launch issues
    http://support.apple.com/kb/ts1717
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Iphone will not send sms, but there is no error message

    Hi!
    I sent a sms to a friend of mine two days ago, but I got no response.
    I contacted NetCom, but the message had not gone out to their net. It had never "left" the phone.
    There is no error message on the phone.
    Does anyone know what I need to do to get this message sent?

    I don't know what SMS provision means..
    There is no exclamation mark next to the message, so it seems that the phone thinks it has sent the message. But it has not arrived NetCom's mobile network to be sent to receiver... I don't understand why.

  • HT204088 The directions you provided above doesnt even work!  when I selected "Click to open your account", there is an ERROR message and takes me to no where!  when I try to access my itunes account, it says I have no history?

    The directions you provided above doesnt even work!  when I selected "Click to open your account", there is an ERROR message and takes me to no where!  when I try to access my itunes account, it says I have no history?

    You are not able to view purchase history on your iOS device.  You may only re-download previous purchases from the iOS device.
    To review your iTunes Store account's purchase history, follow the steps in this article from a computer only:
    Seeing your iTunes Store purchase history and order numbers
    http://support.apple.com/kb/HT2727

Maybe you are looking for

  • I can't burn a disc from iTunes download....error 2131

    error message 2131 stops me from burning a disc from my recent iTunes download.  How can I get around this or fix this ......Windows XP.

  • Bridge CC has downsized half of the files it just imported

    I have just imported 500 plus photos from my Nexus 5. Typically they are 3264 x 2448 and about 1.72M in size. On import, they have been renamed and downsampled/sized to 408 x 306 and about 19 KB. Disaster! I have just spent the morning downloading al

  • Linking to a swapped image...help

    I'm trying to set up a page that has a rightside column of thumbnail images, which, when clickedon opens a larger image in another area. I have done this using swap image. That's all set up, but now I would like to link that larger image to a differe

  • Doubt in this program

    Hi folks, I had one small doubt in the below program...      import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import ja

  • Unable to download Mac App Store

    I downloaded it once, but then my Mac started hanging so I trashed it. Now when I click software update, it says my software is up to date. Is there another way to download Mac App Store...is it even worth it to try? It seems a lot of people are havi