Struts Menu
  1. Struts Menu
  2. SM-57

CSSListMenu produces invalid XHTML when a submenu contains items for which the user has no permissions to see

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.1
    • Fix Version/s: 2.4.2
    • Component/s: Displayers
    • Labels:
      None

      Description

      I have a submenu that contains items where a some users don't have permissions to see any of them although they do have permissions to see the submenu itself.
      The generated code produces empty ul tags (<ul></ul>).
      Validating this against xhtml 1.0 Strict give the following error:
      end tag for "ul" which is not finished.

        Activity

        Hide
        Matt Raible added a comment -

        Can you provide a more detailed example? I'd like to try and reproduce this in order to fix it. Are you using the Java or Velocity version of the CSSListMenu?

        Show
        Matt Raible added a comment - Can you provide a more detailed example? I'd like to try and reproduce this in order to fix it. Are you using the Java or Velocity version of the CSSListMenu?
        Hide
        Tomislav Stojcevich added a comment -

        Using the java version.

        In the menu-config I have something like:

        <Menu name="level1Menu" title="Level1" location="/test/page1.do">
        <Item name="level2Menu" title="Level2" page="/test/page2.do">
        <Item name="level3MenuEntrya" title="Level3a" page="/test/page3a.do" roles="ROLE_A"/>
        <Item name="level3MenuEntryb" title="Level3b" page="/test/page3b.do" roles="ROLE_A"/>
        </Item>
        </Menu>

        No roles on level1 and level2 menu so everybody gets level1 and it contains the level2 menu.
        Both level3 entries have a role specified so only people in ROLE_A see the level3 entries for the level2 menu. Users without ROLE_A don't get the level3 entries.

        The html that gets produces for a non ROLE_A user is empty UL tags for level3 nested in the level2 li.

        <li class="menubar">
        <a href="/test/page1.do">Level1</a>
        <ul>
        <li class="menubar">
        <a href="/test/page2.do">Level2</a>
        <ul>
        </ul>
        </li>
        </ul>
        </li>

        Show
        Tomislav Stojcevich added a comment - Using the java version. In the menu-config I have something like: <Menu name="level1Menu" title="Level1" location="/test/page1.do"> <Item name="level2Menu" title="Level2" page="/test/page2.do"> <Item name="level3MenuEntrya" title="Level3a" page="/test/page3a.do" roles="ROLE_A"/> <Item name="level3MenuEntryb" title="Level3b" page="/test/page3b.do" roles="ROLE_A"/> </Item> </Menu> No roles on level1 and level2 menu so everybody gets level1 and it contains the level2 menu. Both level3 entries have a role specified so only people in ROLE_A see the level3 entries for the level2 menu. Users without ROLE_A don't get the level3 entries. The html that gets produces for a non ROLE_A user is empty UL tags for level3 nested in the level2 li. <li class="menubar"> <a href="/test/page1.do">Level1</a> <ul> <li class="menubar"> <a href="/test/page2.do">Level2</a> <ul> </ul> </li> </ul> </li>
        Hide
        Matt Raible added a comment -

        I've been able to solve this one in the Velocity template, but I'm having a hard time in the Java version. If you figure it out by patching CSSListMenuDisplayer, please let me know.

        Show
        Matt Raible added a comment - I've been able to solve this one in the Velocity template, but I'm having a hard time in the Java version. If you figure it out by patching CSSListMenuDisplayer, please let me know.
        Hide
        Tomislav Stojcevich added a comment -

        I tried to fix it by buffering the output instead of writing it out directly and then testing for any content before writing out the <ul>. Due to the reflexive nature of the code, it wasn't so easy. The output kept coming out incorrect.
        If I have time I'll try it again.

        Show
        Tomislav Stojcevich added a comment - I tried to fix it by buffering the output instead of writing it out directly and then testing for any content before writing out the <ul>. Due to the reflexive nature of the code, it wasn't so easy. The output kept coming out incorrect. If I have time I'll try it again.
        Hide
        Matt Raible added a comment -

        I managed to fix it shortly after posting the comment yesterday. Have you tried the latest code from CVS? I hope to do a release in the next hour or two.

        Show
        Matt Raible added a comment - I managed to fix it shortly after posting the comment yesterday. Have you tried the latest code from CVS? I hope to do a release in the next hour or two.
        Hide
        Tomislav Stojcevich added a comment -

        Can't get the latest code from CVS because i'm behind a proxied firewall at work. cvsgrab 2.2.2 (latest version) doesn't support viewcvs 1.0.1 using by this cvs repo.
        Have to wait till I get home tonight. Or, if you put the jar somewhere i can download it, i'll be happy to test/check it.

        Show
        Tomislav Stojcevich added a comment - Can't get the latest code from CVS because i'm behind a proxied firewall at work. cvsgrab 2.2.2 (latest version) doesn't support viewcvs 1.0.1 using by this cvs repo. Have to wait till I get home tonight. Or, if you put the jar somewhere i can download it, i'll be happy to test/check it.
        Hide
        Matt Raible added a comment -
        Show
        Matt Raible added a comment - You can download the JAR from http://static.appfuse.org/downloads/struts-menu-2.4.2.jar

          People

          • Assignee:
            Matt Raible
            Reporter:
            Tomislav Stojcevich
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development