javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-3169

jsf:action on html buttons changes the rendered markup

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.5
    • Fix Version/s: 2.2.6
    • Component/s: renderkit
    • Labels:
      None

      Description

      I recently noticed that JSF 2.2.5 changes the rendered markup in some cases, which often leads to a broken layout.
      Using this example, you can see how the blue div will get nested into the red div after rendering. Removing the jsf:action from the buttons will solve the problem.

      <div style="background-color: red;">
      <h:form prependId="false">
      <div class="">
      <div>
      <button jsf:action="#

      {dayController.previous}

      ">
      <span></span>
      </button>
      </div>
      <div>
      <input type="text" jsf:id="date" disabled="disabled" value="#

      {dayController.currentDate.dateStr}

      ">
      </input>
      </div>
      <div>
      <button jsf:action="#

      {dayController.next}

      ">
      <span></span>
      </button>
      </div>
      </div>
      </h:form>
      </div> <!-- End red div -->
      <div style="background-color: blue;">
      <table style="border: 2px solid black; width: 100%">
      <tr>
      <td style="border: 2px solid black;">test</td>
      <td style="border: 2px solid black;">table</td>
      </tr>
      </table>
      </div>

        Issue Links

          Activity

          Hide
          pbayer added a comment -

          please note that in the given example you have to replace the EL values with some dummy values.

          Show
          pbayer added a comment - please note that in the given example you have to replace the EL values with some dummy values.
          Hide
          Manfred Riem added a comment -

          Using Glassfish 4.0 I am unable to reproduce what you are seeing.

          Show
          Manfred Riem added a comment - Using Glassfish 4.0 I am unable to reproduce what you are seeing.
          Hide
          pbayer added a comment -

          Which version of Glassfish are you using? I used 4.0 Build 89 running Mojarra 2.2.0 ( 20130502-2118 ) and could reproduce the issue.

          Show
          pbayer added a comment - Which version of Glassfish are you using? I used 4.0 Build 89 running Mojarra 2.2.0 ( 20130502-2118 ) and could reproduce the issue.
          Hide
          Manfred Riem added a comment -

          Please grab the latest 2.2.6-SNAPSHOT and see if you can reproduce it?

          Show
          Manfred Riem added a comment - Please grab the latest 2.2.6-SNAPSHOT and see if you can reproduce it?
          Hide
          pbayer added a comment -

          Hi Manfred,
          thanks for your time. I retested the issue with Mojarra 2.2.6 (-SNAPSHOT 20140123-0811) and Tomcat 7.50 and the page still renders differently than it should. I think the problem is, that the error is not very obvious with the example I have given if you dont know what you are looking for.

          I thought of two possibilities:
          1) You could copy the example page and remove the jsf:action and jsf:id attributes and then compare the rendered pages. You should see a difference

          2) Remove the "background-color: blue". This way you can see how the red div is suddenly enclosing the div containing the table even though it isnt in the original markup.

          Show
          pbayer added a comment - Hi Manfred, thanks for your time. I retested the issue with Mojarra 2.2.6 (-SNAPSHOT 20140123-0811) and Tomcat 7.50 and the page still renders differently than it should. I think the problem is, that the error is not very obvious with the example I have given if you dont know what you are looking for. I thought of two possibilities: 1) You could copy the example page and remove the jsf:action and jsf:id attributes and then compare the rendered pages. You should see a difference 2) Remove the "background-color: blue". This way you can see how the red div is suddenly enclosing the div containing the table even though it isnt in the original markup.
          Hide
          Manfred Riem added a comment -

          Can you please send a reproducer showing both pages to issues@javaserverfaces.java.net? That would help me see what you mean! Thanks!

          Show
          Manfred Riem added a comment - Can you please send a reproducer showing both pages to issues@javaserverfaces.java.net? That would help me see what you mean! Thanks!
          Hide
          Manfred Riem added a comment -

          Applied to 2.2 branch,

          svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3169, make sure that closing of the element does not happen for void elements."
          Sending jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HtmlResponseWriter.java
          Adding test/agnostic/renderKit/passthrough/src/main/webapp/spuriousClosing.xhtml
          Adding test/agnostic/renderKit/passthrough/src/test/java/com/sun/faces/test/agnostic/renderKit/passthrough/Issue3169IT.java
          Transmitting file data ...
          Committed revision 12856.

          Show
          Manfred Riem added a comment - Applied to 2.2 branch, svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3169 , make sure that closing of the element does not happen for void elements." Sending jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HtmlResponseWriter.java Adding test/agnostic/renderKit/passthrough/src/main/webapp/spuriousClosing.xhtml Adding test/agnostic/renderKit/passthrough/src/test/java/com/sun/faces/test/agnostic/renderKit/passthrough/Issue3169IT.java Transmitting file data ... Committed revision 12856.
          Hide
          Manfred Riem added a comment -

          Thanks for the excellent reproducer it helped us narrow down the problem.

          Show
          Manfred Riem added a comment - Thanks for the excellent reproducer it helped us narrow down the problem.

            People

            • Assignee:
              Manfred Riem
              Reporter:
              pbayer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: