MyFaces Core
  1. MyFaces Core
  2. MYFACES-1762

h:messages - error while rendering id and styleClass attributes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.5, 1.2.3
    • Fix Version/s: 1.1.6
    • Component/s: General
    • Labels:
      None
    • Environment:
      windows, jdk16, jetty, maven

      Description

      There is an error while rendering "id" and "styleClass" attributes on "h:messages" component.

      For example:

      <h:messages id="messagesId" styleClass="messagesClass" ...

      is rendered as:

      <ul id="messagesId"><li><span id="messagesId" style="messagesClass" >....</span></li><li><span id="messagesId" style="messagesClass" >

      As you can see:

      • in genereted html we have many tags with the same id attribute,
      • styleClass attribute is rendered as style not as class attribute.

      Regards
      Antoni Jakubiak

        Activity

        Antoni Jakubiak created issue -
        Hide
        Antoni Jakubiak added a comment -

        Quick fix is to create custom renderer which wrap output.

        Show
        Antoni Jakubiak added a comment - Quick fix is to create custom renderer which wrap output.
        Antoni Jakubiak made changes -
        Field Original Value New Value
        Attachment HtmlMessagesRenderer.java [ 12369174 ]
        Hide
        Leonardo Uribe added a comment -

        After checking this bug (multiple html tags with the same id), the conclusion is that this issue should be solved in myfaces core 1.1 and 1.2.

        The solution should be modify the renderers, rather than play with the component attribute map. After looking several solutions, the best is add a param to method renderSingleFacesMessage of HtmlMessageRendererBase called renderId, which could be used for avoid render the id when it is used in HtmlMessagesRendererBase. Obviously, backward compatibility must be maintained using this:

        protected void renderSingleFacesMessage(FacesContext facesContext,
        UIComponent message,
        FacesMessage facesMessage,
        String messageClientId)
        throws IOException

        { renderSingleFacesMessage(facesContext, message, facesMessage, messageClientId,true); }

        protected void renderSingleFacesMessage(FacesContext facesContext,
        UIComponent message,
        FacesMessage facesMessage,
        String messageClientId,
        boolean renderId)
        throws IOException
        {

        Show
        Leonardo Uribe added a comment - After checking this bug (multiple html tags with the same id), the conclusion is that this issue should be solved in myfaces core 1.1 and 1.2. The solution should be modify the renderers, rather than play with the component attribute map. After looking several solutions, the best is add a param to method renderSingleFacesMessage of HtmlMessageRendererBase called renderId, which could be used for avoid render the id when it is used in HtmlMessagesRendererBase. Obviously, backward compatibility must be maintained using this: protected void renderSingleFacesMessage(FacesContext facesContext, UIComponent message, FacesMessage facesMessage, String messageClientId) throws IOException { renderSingleFacesMessage(facesContext, message, facesMessage, messageClientId,true); } protected void renderSingleFacesMessage(FacesContext facesContext, UIComponent message, FacesMessage facesMessage, String messageClientId, boolean renderId) throws IOException {
        Leonardo Uribe made changes -
        Affects Version/s  1.1.6-SNAPSHOT [ 12312311 ]
        Affects Version/s 1.2.3 [ 12313144 ]
        Affects Version/s 1.1.6 [ 12312312 ]
        Leonardo Uribe made changes -
        Affects Version/s 1.1.5 [ 12312310 ]
        Affects Version/s 1.1.6 [ 12312312 ]
        Leonardo Uribe made changes -
        Fix Version/s 1.2.4-SNAPSHOT [ 12313145 ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Leonardo Uribe [ lu4242 ]
        Fix Version/s  1.1.6-SNAPSHOT [ 12312311 ]
        Leonardo Uribe made changes -
        Fix Version/s 1.2.4-SNAPSHOT [ 12313145 ]
        Fix Version/s  1.1.6-SNAPSHOT [ 12312311 ]
        Fix Version/s 1.1.6 [ 12312312 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        270d 9h 16m 1 Leonardo Uribe 04/Aug/08 19:44

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Antoni Jakubiak
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development