Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-1555

h:messages and h:message don't use style attribute when rendering

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.1.5, 1.1.6-SNAPSHOT, 1.2.0-SNAPSHOT
    • 1.1.6
    • None
    • None

    Description

      When I use
      <h:messages layout="table" showSummary="false" showDetail="true" style="color: red"></h:messages>
      the style attribute has no effect on generated html.
      If I change it to
      <h:messages layout="table" showSummary="false" showDetail="true" errorStyle="color: red"></h:messages>
      then it works correctly.

      I have looked at the code and here is the cause:

      File: HtmlMessagesRendererBase.java (org/apache/myfaces/shared/renderkit/html/HtmlMessagesRendererBase.java)
      Lines: 199-202
      Code:
      if (style == null)

      { style = (String)attr.get(org.apache.myfaces.shared.renderkit.JSFAttr.STYLE_CLASS_ATTR); }

      I believe that the attribute to be used here must be JSFAttr.STYLE_ATTR (not JSFAttr.STYLE_CLASS_ATTR)

      This fix should apply to HtmlMessageRendererBase.java too because h:message has the same problem.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            thaiha@psv.com.vn Thai Ha
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment