[thelist] JSP Help

Ani Phelan aphelan at ajava.biz
Tue Jun 8 11:09:48 CDT 2004


OK,
I have a navigation script on my site that uses JavaScript to create an
expandable menu. I want to keep all the JavaScript off of the HTML pages
so I use JSP to write in the appropriate variable to keep the menu
expanded for each section... I've included the code below. As you can
see, it's very simple if you only have two sections to work with.. if
the URL is on the switches directory, it writes nothing to the first
menu and treenodeshow to the switches menu, otherwise it writes the
treenodeshow menu to expand the Routers menu. For now unless the site is
open to a specific submenu I want the nav to default to leaving Routers
open. But I need to add the new section, Wireless, and I'm not sure how
to write this so that it will write treenodeshow to the appropriate
section & default to Routers when I'm dealing with more than two
sections... hope that makes sense :P You can se the nav in action here
http://www.ajavanetworking.com if that helps 
 
Ani
 
<!---Start Nav Code--->
 
<ul class="treemenu singleopen">
            <li class="treenode">
                        <a href="">Routers</a>
                        <ul>
                                    <li  <%
                                    if
(onPage.startsWith("/cisco/systems/switches/"))
                                    {
                                                %>
 
                                                <%
                                                }
                                                else
                                                {
                                                %>
                                    class="treenodeshow"

                                                <%
                                                }
                                                %> ><a
href="/cisco/systems/routers/cisco_SOHO_series.jsp"
class="menuLink">Cisco SOHO Series</a></li>
                                                <li><a
href="/cisco/systems/routers/cisco_8100_series.jsp"
class="menuLink">Cisco 8100 Series</a></li>
                        </ul>
            </li>
            <li class="treenode">
                        <a href="">Switches</a>
                        <ul>
                                    <li  <%
                                                if
(onPage.startsWith("/cisco/systems/switches/"))
                                                {
                                                %>
                                                class="treenodeshow"
                                                <%
                                                }
                                                else
                                                {
                                                %>
                  
                                                <%
                                                }
                                                %> ><a
href="/cisco/systems/switches/cisco_8900_series.jsp"
class="menuLink">Catalyst MGX 8900</a></li>                   
                                                <li><a
href="/cisco/systems/switches/cisco_8800_series.jsp"
class="menuLink">MGX 8800 Series</a></li>              
                        </ul>
            </li>
            <li class="treenode">
                        <a href="">Wireless</a>
                        <ul>
                                                <li><a
href="/cisco/systems/wireless/cisco_aironet_wireless.jsp"
class="menuLink">Cisco Aironet Wireless</a></li>
                                                <li><a
href="/cisco/systems/wireless/cisco_wt2700_fixed_wireless_access.jsp"
class="menuLink">Cisco WT2700</a></li>          
                        </ul>
            </li>
 
</ul>
 
<!---End Nav Code--->
 
 


More information about the thelist mailing list