You can check out the Struts Menu project from SourceForge if you want
to look at the code:

http://struts-menu.sf.net

The MenuRepository.java in src/java/net/sf/navigator/menu has an
initDigester() method that does most of the parsing work.  This is
done using Commons Digester.  Here's an article on digester that may
help you understand it better:

http://www.onjava.com/pub/a/onjava/2002/10/23/digester.html

Matt

On 2/21/07, Fan <[EMAIL PROTECTED]> wrote:

How does the configuration file being parsed and read to generate the menu ?
I wish to know the mechanism behind it



Michael Horwitz wrote:
>
> The menu is generated using the menu-config.xml configuration file
> directly
> below WEB-INF.
>
> Mike.
>
>
> On 2/21/07, Fan <[EMAIL PROTECTED]> wrote:
>>
>>
>> how's the menu being generated in Appfuse 2.0 ?
>>
>> I wish to trace if generating more than 3 levels of menu is possible
>>
>>
>> Fan wrote:
>> >
>> > here is my menu-config.xml :
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <MenuConfig>
>> >     <Displayers>
>> >         <Displayer name="Velocity"
>> > type="net.sf.navigator.displayer.VelocityMenuDisplayer"/>
>> >     </Displayers>
>> >     <Menus>
>> >         <Menu name="MainMenu" title="mainMenu.title"
>> > page="/mainMenu.html"/>
>> >         <Menu name="UserMenu" title="menu.user" description="User Menu"
>> > page="/editProfile.html" roles="admin,user"/>
>> >         <Menu name="FileUpload" title="menu.selectFile"
>> description="File
>> > Upload" width="100" page="/uploadFile!start.html" roles="admin,user"/>
>> >         <Menu name="AdminMenu" title="menu.admin" description="Admin
>> Menu"
>> > roles="admin" width="120" page="/users.html">
>> >             <Item name="ViewUsers" title="menu.admin.users"
>> > page="/users.html"/>
>> >             <Item name="ActiveUsers" title="mainMenu.activeUsers"
>> > page="/activeUsers.html"/>
>> >             <Item name="ReloadContext" title="menu.admin.reload"
>> > page="/reload.html"/>
>> >
>> >             <Item name="FlushCache" title="menu.flushCache"
>> > page="/flushCache.html"/>
>> >
>> >             <Item name="Clickstream" title="menu.clickstream"
>> > page="/clickstreams.jsp">
>> >
>> >               <Item name="ViewStores" title="menu.viewStore"
>> > page="/stores.html">
>> >                  <Item name="ViewStores" title="menu.viewStore"
>> > page="/stores.html"/>
>> >               </Item>
>> >
>> >             </Item>
>> >
>> >         </Menu>
>> >         <Menu name="Logout" title="user.logout" page="/logout.jsp"
>> > roles="admin,user"/>
>> >     </Menus>
>> > </MenuConfig>
>> >
>> > here is the generated HTML :
>> >
>> > <ul id="primary-nav" class="menuList">
>> >     <li class="pad"></li>
>> >
>> >     <li>
>> >        /mainMenu.html Main Menu
>> >     </li>
>> >
>> >     <li>
>> >         /editProfile.html Edit Profile
>> >     </li>
>> >
>> >     <li>
>> >          /uploadFile!start.html Upload A File
>> >     </li>
>> >
>> >     <li class="menubar">
>> >          /users.html Administration
>> >
>> >         <ul>
>> >
>> >             <li>
>> >                  /users.html View Users
>> >             </li>
>> >
>> >             <li>
>> >                  /activeUsers.html Current Users
>> >             </li>
>> >
>> >             <li>
>> >                  /reload.html Reload Options
>> >             </li>
>> >
>> >             <li>
>> >                  /flushCache.html Flush Cache
>> >             </li>
>> >
>> >             <li class="menubar">
>> >                  /clickstreams.jsp Clickstream
>> >
>> >        <ul>
>> >             <li class="menubar">
>> >                  /stores.html View Stores
>> >        <ul>
>> >             <li class="last">
>> >                  /stores.html View Stores
>> >             </li>
>> >        </ul>
>> >
>> >    </li>
>> >    </li>
>> >    </li>
>> >
>> >    <li>
>> >         /logout.jsp Logout
>> >    </li>
>> > </ul>
>> >
>> >
>> >
>> > Matt Raible-3 wrote:
>> >>
>> >> If you look at the generated HTML - does it appear to be correct?  If
>> >> so, it's probably a CSS issue.  If not, then it's probably a Velocity
>> >> template issue.
>> >>
>> >> Matt
>> >>
>> >> On 9/26/06, Fan <[EMAIL PROTECTED]> wrote:
>> >>>
>> >>> I want to archieve this
>> >>>
>> >>> Administration
>> >>>      |-- View Users -- View Users -- View Users
>> >>>      |--Current Users
>> >>>      |--Reload Options
>> >>>      |--Flush Cache
>> >>>      |--ClickStream
>> >>>
>> >>> Logout
>> >>>
>> >>>
>> >>> with the following config:
>> >>>
>> >>> <Menu name="AdminMenu" title="menu.admin" description="Admin Menu"
>> >>> roles="admin" width="120" forward="viewUsers">
>> >>>
>> >>>             <Item name="ViewUsers1" title="menu.admin.users"
>> >>> forward="viewUsers">
>> >>>                <Item name="ViewUsers2" title="menu.admin.users"
>> >>> forward="viewUsers">
>> >>>                    <Item name="ViewUsers3" title="menu.admin.users"
>> >>> forward="viewUsers"/>
>> >>>                </Item>
>> >>>             </Item>
>> >>>
>> >>>             <Item name="ActiveUsers" title="mainMenu.activeUsers"
>> >>> action="activeUsers"/>
>> >>>             <Item name="ReloadContext" title="menu.admin.reload"
>> >>> action="reload"/>
>> >>>
>> >>>             <Item name="FlushCache" title="menu.flushCache"
>> >>> action="flush"/>
>> >>>             <Item name="Clickstream" title="menu.clickstream"
>> >>> page="/clickstreams.jsp"/>
>> >>>
>> >>> </Menu>
>> >>> <Menu name="Logout" title="user.logout" page="/logout.jsp"
>> >>> roles="admin,user"/>
>> >>>
>> >>>
>> >>>
>> >>> but ended up with this result:
>> >>>
>> >>> Administration
>> >>>      |-- View Users   -- View Users         -- View Users
>> >>>      |-- Logout       |--Current Users
>> >>>                           |--Reload Options
>> >>>                           |--Flush Cache
>> >>>                           |--ClickStream
>> >>>
>> >>>
>> >>>
>> >>> Any clue ??
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> Fan wrote:
>> >>> >
>> >>> > Cool !!! the advice really helps !!! TQ Matt
>> >>> >
>> >>> >
>> >>> >
>> >>> > Matt Raible-3 wrote:
>> >>> >>
>> >>> >> On 8/31/06, Fan <[EMAIL PROTECTED]> wrote:
>> >>> >>>
>> >>> >>> I did use nested <Item> , it was possible to have third level of
>> >>> menu,
>> >>> >>> but
>> >>> >>> the third level menu did overlap the second level menu
>> >>> >>
>> >>> >> You should be able to fix this with some minor CSS changes.
>> >>> >>
>> >>> >> http://tinyurl.com/fuweg
>> >>> >>
>> >>> >> Matt
>> >>> >>
>> >>> >>>
>> >>> >>>
>> >>> >>> Fan wrote:
>> >>> >>> >
>> >>> >>> > Is it something like the following ? :
>> >>> >>> >
>> >>> >>> > <Menus>
>> >>> >>> >         <Menu name="MainMenu" title="mainMenu.title"
>> >>> >>> > page="/mainMenu.html"/>
>> >>> >>> >         <Menu name="UserMenu" title="menu.user"
>> description="User
>> >>> >>> Menu"
>> >>> >>> > forward="editProfile"    oles="admin,user"/>
>> >>> >>> >         <Menu name="FileUpload" title="menu.selectFile"
>> >>> >>> description="File
>> >>> >>> > Upload" width="100" forward="selectFile" roles="admin,user"/>
>> >>> >>> >         <Menu name="PeopleMenu" title="menu.viewPeople"
>> >>> >>> > forward="viewPeople"/>
>> >>> >>> >         <Menu name="AdminMenu" title="menu.admin"
>> >>> description="Admin
>> >>> >>> Menu"
>> >>> >>> > roles="admin" width="120" forward="viewUsers">
>> >>> >>> >             <Item name="ViewUsers" title="menu.admin.users"
>> >>> >>> > forward="viewUsers"/>
>> >>> >>> >             <Item name="ActiveUsers"
>> title="mainMenu.activeUsers
>> "
>> >>> >>> > action="activeUsers"/>
>> >>> >>> >             <Item name="ReloadContext"
>> title="menu.admin.reload"
>> >>> >>> > action="reload"/>
>> >>> >>> >             <Item name="FlushCache" title="menu.flushCache"
>> >>> >>> > action="flush"/>
>> >>> >>> >             <Item name="Clickstream" title="menu.clickstream"
>> >>> >>> > page="/clickstreams.jsp"/>
>> >>> >>> >
>> >>> >>> >                     <Item name="SubClickstream"
>> >>> >>> > title="menu.subclickstream" page="/subclickstreams.jsp"/>
>> >>> >>> >             </Item>
>> >>> >>> >         </Menu>
>> >>> >>> >         <Menu name="Logout" title="user.logout"
>> page="/logout.jsp"
>> >>> >>> > roles="admin,user"/>
>> >>> >>> >     </Menus>
>> >>> >>> >
>> >>> >>> >
>> >>> >>> >
>> >>> >>> >
>> >>> >>> >
>> >>> >>> > Matt Raible-3 wrote:
>> >>> >>> >>
>> >>> >>> >> You should be able to use many nested <Item> elements to
>> achieve
>> >>> what
>> >>> >>> >> you're looking for.
>> >>> >>> >>
>> >>> >>> >> Matt
>> >>> >>> >>
>> >>> >>> >> On 7/31/06, Andr? Faria <[EMAIL PROTECTED]> wrote:
>> >>> >>> >>>
>> >>> >>> >>>  Is possivel to build a menu with 3 or more levels with
>> Struts
>> >>> Menu,
>> >>> >>> if
>> >>> >>> >>> yes,
>> >>> >>> >>> can you give me a menu-config.xml example ?
>> >>> >>> >>>
>> >>> >>> >>>  Like:
>> >>> >>> >>>
>> >>> >>> >>>  File
>> >>> >>> >>>    |-- Text
>> >>> >>> >>>           |--- DOC
>> >>> >>> >>>           |--- RTF
>> >>> >>> >>>           |--- TXT
>> >>> >>> >>>     |--Images
>> >>> >>> >>>            |--GIF
>> >>> >>> >>>                  |--Static
>> >>> >>> >>>                  |--Animated
>> >>> >>> >>>  ...
>> >>> >>> >>>
>> >>> >>> >>>
>> >>> >>> >>>
>> >>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> >>> >>> To unsubscribe, e-mail:
>> >>> >>> >>> [EMAIL PROTECTED] For additional
>> >>> >>> >>> commands, e-mail: [EMAIL PROTECTED]
>> >>> >>> >>
>> >>> >>> >>
>> >>> ---------------------------------------------------------------------
>> >>> >>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >>> >>> >> For additional commands, e-mail:
>> [EMAIL PROTECTED]
>> >>> >>> >>
>> >>> >>> >>
>> >>> >>> >>
>> >>> >>> >
>> >>> >>> >
>> >>> >>>
>> >>> >>> --
>> >>> >>> View this message in context:
>> >>> >>>
>> >>>
>> 
http://www.nabble.com/Struts-Menus-with-3-or-more-Levels-tf2029896s2369.html#a6080083
>> >>> >>> Sent from the AppFuse - User forum at Nabble.com.
>> >>> >>>
>> >>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >>> >>> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>> >>>
>> >>> >>>
>> >>> >>
>> >>> >>
>> >>> >
>> >>> >
>> >>>
>> >>> --
>> >>> View this message in context:
>> >>>
>> 
http://www.nabble.com/Struts-Menus-with-3-or-more-Levels-tf2029896s2369.html#a6509817
>> >>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >>> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>>
>> >>>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> 
http://www.nabble.com/Struts-Menus-with-3-or-more-Levels-tf2029896s2369.html#a9080780
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>

--
View this message in context: 
http://www.nabble.com/Struts-Menus-with-3-or-more-Levels-tf2029896s2369.html#a9081379
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to