MyFaces Core
  1. MyFaces Core
  2. MYFACES-2139

h:messages don't use styleClass attribute when rendering

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.6, 1.2.6
    • Fix Version/s: 1.1.7, 1.2.7
    • Component/s: None
    • Labels:
      None

      Description

      MyFaces breaks compatibility with Sun RI as the styleClass attribute is not rendered for h:messages.
      The styleClass attribute should be applied to the <ul> element (or the <table> element if in table layout).

      1. HtmlRendererBase.patch
        2 kB
        Frank-Michael Jaeschke

        Issue Links

          Activity

          Hide
          Frank-Michael Jaeschke added a comment -

          provides styleClass and style attributes to list and table

          Show
          Frank-Michael Jaeschke added a comment - provides styleClass and style attributes to list and table
          Hide
          Leonardo Uribe added a comment -

          This issue is part of TOMAHAWK-1082. I believe we should render messages like this:

          <ul>
          <li class="errorClass">message</li>
          </ul>

          and apply it on both shared 2.0.x and 3.0.x, (jsf 1.1 and 1.2). If no objections I'll change the current behavior to this.

          Show
          Leonardo Uribe added a comment - This issue is part of TOMAHAWK-1082 . I believe we should render messages like this: <ul> <li class="errorClass">message</li> </ul> and apply it on both shared 2.0.x and 3.0.x, (jsf 1.1 and 1.2). If no objections I'll change the current behavior to this.
          Hide
          Leonardo Uribe added a comment -

          Fixed on both branches. The patch missed some points, because HtmlMessageRenderer is parent of HtmlMessagesRenderer. Thanks to Frank-Michael Jaeschke for the tips.

          Show
          Leonardo Uribe added a comment - Fixed on both branches. The patch missed some points, because HtmlMessageRenderer is parent of HtmlMessagesRenderer. Thanks to Frank-Michael Jaeschke for the tips.
          Hide
          Frank-Michael Jaeschke added a comment -

          I think the fix is not complete yet.

          Rendering styleClass and style attributes to the component is missing.

          According to sun jsf 1.1 tld doc (http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/tlddocs/index.html),
          for example we have
          errorClass - CSS style class to apply to any message with a severity class of "ERROR"
          fatalClass - CSS style class to apply to any message with a severity class of "FATAL" and so on.

          A single message is rendered to
          <li class="errorClass">message</li>
          this is perfect now.

          But tld contains also
          styleClass - Space-separated list of CSS style class(es) to be applied when this element is rendered. This value must be passed through as the "class" attribute on generated markup.

          So I would assume

          <h:messages styleClass="styleClass" errorClass="errorClass"/>

          would be rendered to

          <ul class="styleClass">
          <li class="errorClass">message</li>
          </ul>

          Show
          Frank-Michael Jaeschke added a comment - I think the fix is not complete yet. Rendering styleClass and style attributes to the component is missing. According to sun jsf 1.1 tld doc ( http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/tlddocs/index.html ), for example we have errorClass - CSS style class to apply to any message with a severity class of "ERROR" fatalClass - CSS style class to apply to any message with a severity class of "FATAL" and so on. A single message is rendered to <li class="errorClass">message</li> this is perfect now. But tld contains also styleClass - Space-separated list of CSS style class(es) to be applied when this element is rendered. This value must be passed through as the "class" attribute on generated markup. So I would assume <h:messages styleClass="styleClass" errorClass="errorClass"/> would be rendered to <ul class="styleClass"> <li class="errorClass">message</li> </ul>
          Hide
          Leonardo Uribe added a comment -

          Yes, you're right. Changed to proposed behavior on both branches and modified junit test to detect this condition. Thanks to Frank-Michael Jaeschke for the attention in the details.

          Show
          Leonardo Uribe added a comment - Yes, you're right. Changed to proposed behavior on both branches and modified junit test to detect this condition. Thanks to Frank-Michael Jaeschke for the attention in the details.

            People

            • Assignee:
              Leonardo Uribe
              Reporter:
              Frank-Michael Jaeschke
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development