Dynamic Menu in JSP

Hi,
I have to make a menu just like www.staple.com in my JSP. The main product category and sub-category are read from the database. I have classes written which retrieve the product and sub categories but dont know hot to proceed with building of dynamic menu in my JSP. Please let me know how to move forward for this one.
Thanks

Hi,
I tried to do something like this :
*******CODE*******
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@taglib uri="/struts-tags" prefix="s"%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
     <style type="text/css">
     body {
          font-family: arial, helvetica, serif;
     #nav, #nav ul { /* all lists */
          padding: 0;
          margin: 0;
          list-style: none;
          float : left;
          width : 11em;
     #nav li { /* all list items */
          position : relative;
          float : left;
          line-height : 1.25em;
          margin-bottom : -1px;
          width: 11em;
     #nav li ul { /* second-level lists */
          position : absolute;
          left: -999em;
          margin-left : 11.05em;
          margin-top : -1.35em;
     #nav li ul ul { /* third-and-above-level lists */
          left: -999em;
     #nav li a {
          width: 11em;
          w\idth : 10em;
          display : block;
          color : black;
          font-weight : bold;
          text-decoration : none;
          background-color : white;
          border : 1px solid black;
          padding : 0 0.5em;
     #nav li a:hover {
          color : white;
          background-color : black;
     #nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul {
          left: -999em;
     #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul { /* lists nested under hovered list items */
          left: auto;
     #content {
          margin-left : 12em;
</style>
<script type="text/javascript">
sfHover = function() {
     var sfEls = document.getElementById("nav").getElementsByTagName("LI");
     for (var i=0; i<sfEls.length; i++) {
          sfEls.onmouseover=function() {
               this.className+=" sfhover";
          sfEls[i].onmouseout=function() {
               this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
if (window.attachEvent) window.attachEvent("onload", sfHover);
//--><!]]></script>
</head>
<body>
<ul id="nav">
     <s:iterator value="productList" id="products">     
               <li> <s:url id="getProductCategoryCodesURL" action="listProductCategoryCodesByProductCd">
                                                  <s:param name="productCd" value="%{productCd}"></s:param>
                                             </s:url>                                              
                                             <s:a href="%{getProductCategoryCodesURL}" ><s:property value="productNm" /></s:a>
                                             <input type="hidden" id="prodCd" value="<s:property value="productCd" />"/>
                         </li>
</s:iterator>
</ul>
</body>
</html>
****END CODE******
So i was able to get the product categories in the menu but on mouse hover for a particular product category it should show sub-categories also. I can't think of a way to do that , can anyone please suggest ?

Similar Messages

  • How we can generate dynamic menu in jsp page

    Hi all,
    how we can generate dynamic menu in jsp page.
    Thanks
    Manjinder

    by reading more about them on the web or in a good book, OR BY HIRING SOMEBODY TO DO SO. ;)

  • Make a dynamic menu using JSP or Javascript

    Hi ,
    I am trying to make a dynamic menu that is using data retrieved from database in the form of a list.
    I have a javascript to make a tree structure menu, but i need to iterate through the list i am reciveing from the database to make the tree structure. here is the code :-
    <Please reply ASAP as my deadline is near>
    <Note:- in javascript to make static menu ul tag is used to make the parent node and li tag is use to make the child node>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <SCRIPT LANGUAGE="JavaScript" SRC="mktree.js"></SCRIPT>
    <LINK REL="stylesheet" HREF="mktree.css">
    </head>
    <body>
    <%@ page import = "java.util.ArrayList, java.util.Iterator, java.util.List, \WEB-INF\classes\DO_JSP.class,
    \WEB-INF\classes\Url_Name.class, java.util.Comparator, java.util.TreeSet, \WEB-INF\classes\MyComp.class" %>
    <%
         class Url_Name {
         String linkName;
         String linkUrl;
         int order;
         * @return the order
         public int getOrder() {
              return order;
         * @param order the order to set
         public void setOrder(int order) {
              this.order = order;
         * @return the linkName
         public String getLinkName() {
              return linkName;
         * @param linkName the linkName to set
         public void setLinkName(String linkName) {
              this.linkName = linkName;
         * @return the linkUrl
         public String getLinkUrl() {
              return linkUrl;
         * @param linkUrl the linkUrl to set
         public void setLinkUrl(String linkUrl) {
              this.linkUrl = linkUrl;
    class MyComp implements Comparator{
         public int compare(Object a, Object b){
              return (((Url_Name)a).getOrder() - ((Url_Name)b).getOrder());
         class DO_JSP
         int parentId;
         String parentName;
         TreeSet linkList;
         Url_Name tempurl;
         * @return the linkList
         DO_JSP(){
              linkList = new TreeSet(new MyComp());
         public TreeSet getLinkList() {
              return linkList;
         * @param linkList the linkList to set
         public void setLinkList(String linkName, String linkUrl, int order) {
              tempurl = new Url_Name();
              tempurl.setLinkName(linkName);
              tempurl.setLinkUrl(linkUrl);
              tempurl.setOrder(order);
              this.linkList.add(tempurl);
         * @return the parentName
         public String getParentName() {
              return parentName;
         * @param parentName the parentName to set
         public void setParentName(String parentName) {
              this.parentName = parentName;
         * @return the parentId
         public int getParentId() {
              return parentId;
         * @param parentId the parentId to set
         public void setParentId(int parentId) {
              this.parentId = parentId;
    %>
    <%
              List listdojsp =new ArrayList();
              listdojsp = (List)session.getAttribute("JspListName");
              Iterator it = listdojsp.iterator();
              do
    %>
              <%
              DO_JSP tempdojsp = (DO_JSP)it.next();
              String Parent = tempdojsp.getParentName();
              %>
              <ul class="mktree">     
              <li> Parent </li>
                   <ul>
              <%
              Iterator ittemp = tempdojsp.getLinkList().iterator();
                   do
                        Url_Name tempurlname = new Url_Name();
                        tempurlname = (Url_Name)ittemp.next();
                        String link = tempurlname.getLinkName();
              %>
                        <li>link</li>
              <%
                   }while(ittemp.hasNext());
              %>
                   </ul>
                   </ul>          
              <%     
              }while(it.hasNext());
              %>
    </body>
    </html>

    Hi ,
    I am trying to make a dynamic menu that is using data
    retrieved from database in the form of a list.
    I have a javascript to make a tree structure menu,
    but i need to iterate through the list i am reciveing
    from the database to make the tree structure. here is
    the code :- Hi, do you have a question? This is more of a "Look what I wrote" sort of post, and you don't seem to be asking for any specific advice. Please tell us what problem you're having, or the error message you're receiving.
    Brian

  • Dynamic menu in tree structure in JSP

    Hi,
    1) I need to display a dynamic menu in JSP. The menu depends on the values received from database. I need to show the items in the structure of tree (like parents, child relation). The tree can have multiple levels (the parent can have children & these children too can have children). This tree structure would be on left side of the screen.
    I would like to use some custom tags rather than javascript. Can somebody post the custom tags or some samples?
    2) Also, once the user selects different items from menu, different action classes should be called. And accordingly, the right side of the screen will show different data.
    So, there should be any way to set different action classes for the menu items. Please post any samples or helpful links.

    Hi,
    1) I need to display a dynamic menu in JSP. The menu depends on the values received from database. I need to show the items in the structure of tree (like parents, child relation). The tree can have multiple levels (the parent can have children & these children too can have children). This tree structure would be on left side of the screen.
    I would like to use some custom tags rather than javascript. Can somebody post the custom tags or some samples?
    2) Also, once the user selects different items from menu, different action classes should be called. And accordingly, the right side of the screen will show different data.
    So, there should be any way to set different action classes for the menu items. Please post any samples or helpful links.

  • Dynamic menu creation in JSP treating source as dynamic xml

    Hi Everyone,
    I have a XML file which is a dynamic one..It is generated from a tool..I need to parse that xml and generate a menu accordingly in a jsp.In menu the data to be displayed comes from thie hierarchical xml file which is a dynamic one..Siblings and child notes are not fixed..it all generates at rum by some other tool.
    Please help me to tell any logic to create such a dynamic menu ...i am using Dom parser to parse that..
    Regards
    Sajal

    Hi
    This is the xml...I want to display the values in a JSP menu..These values comes from this XML...Like for this XML the struscture will be like
    --Category
    |
    | IT Services
    |
    |ABC Softwares
    |
    |Application Developement
    |
    |Java
    |Mainframes
    |Production Support
    <DIMENSIONS>
    <DIMENSION NAME="CATEGORY">
    <DIMENSION_NODE>
    <DVAL>
    <DVAL_ID ID="1"/>
    <VALUE>IT Services</VALUE>
    </DVAL>
    <DIMENSION_NODE>
    <DVAL>
    <DVAL_ID ID="2"/>
    <VALUE>ABC Softwares</VALUE>
    </DVAL>
    <DIMENSION_NODE>
    <DVAL>
    <DVAL_ID ID="3"/>
    <VALUE>Application Development</VALUE>
    </DVAL>
    <DIMENSION_NODE>
    <DVAL>
    <DVAL_ID ID="4"/>
    <VALUE>Java</VALUE>
    </DVAL>
    </DIMENSION_NODE>
    <DIMENSION_NODE>
    <DVAL>
    <DVAL_ID ID="5"/>
    <VALUE>Mainframes</VALUE>
    </DVAL>
    </DIMENSION_NODE>
    </DIMENSION_NODE>
    <DIMENSION_NODE>
    <DVAL>
    <DVAL_ID ID="6"/>
    <VALUE>Production SUpport</VALUE>
    </DVAL>
    </DIMENSION_NODE>
    </DIMENSION_NODE>
    <DIMENSION_NODE>
    <DVAL>
    <DVAL_ID ID="7"/>
    <VALUE>DEF Softwares</VALUE>
    </DVAL>
    <DIMENSION_NODE>
    <DVAL>
    <DVAL_ID ID="8"/>
    <VALUE>Application Development</VALUE>
    </DVAL>
    </DIMENSION_NODE>
    <DIMENSION_NODE>
    <DVAL>
    <DVAL_ID ID="9"/>
    <VALUE>Production SUpport</VALUE>
    </DVAL>
    </DIMENSION_NODE>
    </DIMENSION_NODE>
    </DIMENSION_NODE>
    </DIMENSION>
    </DIMENSIONS>
    So in this way i need to populate the data from XML.. there can be n number of nodes child nodes and Siblings..and siblings can also have further Child nodes...So need to populate the JSP Menu from this xml..
    Please suggest some logic or if somebody has some sample code..

  • ADF - managed bean error in dynamic menu creation

    scenario:
    to create dynamic menu for two tabs : general..
    general has a subtabmenu in form of menubar wid items: country, city,...
    i created dynamic menus for my application.wen i ran my page i got this error:
    SEVERE: Managedbean menuItem_General could not be created Can't get value from value binding expression:
    '#{resources['erms.menu.gen']}'
    (erms.menu.gen is an entry in UIResources.properties)
    now, i followed the exact same process as mentioned in the SRDemo application, in adfdevguide!
    double checked that
    i. resource adapter is configured in faces-config.
    ii.menu model and menuTreeModel are configured with thier default adapaters in faces-config.
    iii.resource bundle specified in jsp page.
    can sum1 plz refer
    1.wat is the reason of this error? wat are the things dat shud hold true in order to run these dynamic menu? which files shud
    b specified where?
    2. in wat order are the managedbeans created ?
    is it in order they apprear in faces-config file or in order they are used in the jsp page?
    3: is it possible that u click on a menuTab item and it displays its particular menubar's items while staying on the same page? or
    u click on a menubar item and it displays its particular dropdowns while staying on the same page?
    is it posible wid ADF or javascript shud b used?

    Hi,
    looking at code it seems that you are adding textview and inputfield. please check in debugging if the correct context node/attribute  is being created and you are providing its reference while adding UI elements.
    Thanks,
    Chandra

  • How to make menu in jsp ?  urgent

    how can i make a menu in jsp? i have made one js file and one css file and included them in my jsp file. but its not giving any results . please help me out
    its urgent

    And exactly what do you want to achieve?
    A menu with dynamic content generated from a database table or something like that?
    If it's static just use static HTML or JS code as part of the JSP, if dynamic generate that HTML or JS on the fly.

  • How to add a dynamic menu to the Portal?

    Dear all,
    I am restructuring the company's Intranet on which I plan to put a left-side vertical menu. On the menu, most links are accessible to all Intranet users except some KPI (key performance indicators) links which are only accessible to managers.
    I am evaluating a third-party dynamic menu builder so called "Sothink DHTML Menu" which is javascript based and provides features for connecting to database via JDBC in jsp.
    For static menu scenario, "Sothink DHTML Menu" is perfect for Oracle Portal in the sense of easy development and deployment.
    For dynamic menu scenario, if I really want to use "Sothink DHTML Menu", I need to put the codes in jsp file and then place the jsp file on the Portal page. Here is the tutorial http://www.sothink.com/product/dhtmlmenu/store/jspdb/jspdb.htm
    I still can't figure out how to do that. Can any experts here tell me how or suggest other alternatives for generating a dynamic menu on Portal?
    Thanks
    George (HK)

    Hi
    I also use SoThink menus in Oracle Portal, but for static menus (I upload them in the HtDocs of Apache and then refer to them with an URL Item).
    In my previous version of Portal I also had to display some kind of dynamic menus, some parts should only be visible to some users/groups. But I didn't use Sothink at this moment but "DHTML Menus" from an other company.
    Starting from an example and using their libraries I wrote my own menu in javascript. In this .js I wrote some functions
    - 1 that document.write(s) the start of the menu and the public part of the menu
    - 1 that document.write(s) the reserved part of the menu
    - 1 that document.write(s) the last part of the menu.
    Then in a navigation page I defined 3 regions, each region contains some jscript code that launchs the function/menu part of the same range. And I used the item level security to set right access to the second region/menu part.
    It worked fine, I just had to add some /* at the end of region 1 ent */ at the beginning of region 2 to remove the HTML code Portal writes between the regions.
    But it was very time consuming if your menu changes often.

  • How to create Static menu and Dynamic menu..?

    Hi,
         I'm new to flash and Action Script, I need to add static menu and dynamic menu to my application. I'm using Action Script 1.0. Can you help me to solve my problem..?
    Regards,
    Appu

    Hi Adithya,
    I think the following article is a great resource :
    http://www.ibm.com/developerworks/library/os-eclipse-3.3menu /index.html
    The current documentation for popup menu could be found here :
    http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench_basicext_popupMenus.htm
    (it is also available locally if you install the Eclipse Platform SDK, in "Help" -> "Help Contents"-> "Platform Plug-in Developer guide")
    Best regards,
    Mariot
    adithya a écrit :
    > Hello,
    > Can anyone tell me as to how to create a 'Context Menu' (static and
    > dynamic)??
    > Also what is the difference between a static and dynamic context menus?
    >
    > Are there any javadocs or tutorials?
    > Please help.
    >
    > Adithya.
    >

  • In outlook 2013 Add-In, Adding dynamic menu to splitButton idMso="DialMenu" is working and the same code is not working in outlook 2010 Add-In.

    In outlook 2013 Add-In, Adding dynamic menu to <splitButton idMso="DialMenu"> is working and the same code is not working in outlook
    2010 Add-In. please let me know, if i am missing something. Below is the xml and screen shot
    <contextMenu idMso="ContextMenuFlaggedContactItem">
     <splitButton idMso="DialMenu">
              <menu>
                <dynamicMenu id="CallContactwithFreedomvoice
    " label="CallContactwithFreedomvoice" 
                            getContent="OnGetContenttest"                           insertAfterMso="Call"/> 
            </menu>       </splitButton>    </contextMenu> 

    Hi Narasimha prasad2,
    Based on the description, the context menu for the flagged contact doen't work in Outlook. I am tring to rerpoduce this issue however failed.
    I suggest that you check the state of the add-in first to see wether the add-in was loaded successfully.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • New page not being opened in new window when using a dynamic menu

    I have read an earlier post about this but I didn't really see a solution I could implement there. I have a dynamic menu, and I want one item on it to open a new frame. Here is the module code from the template.
    {module_menu, version="2", menuId="901683", moduleTemplateGroup="Default"}
    It is the main template menu from the Tribeca site template.
    I have tried inserting (_blank) into the appropriate target frame, and still it opens in the same window.  I gathered from the previous post that it was a version issue, but as you can see, the code says "version 2"... or am I mis-reading that?
    I couldn't find where to make changes. The previous post suggested I look for the CSS on the home template, but I am not using a home template.
    Any thoughts?
    Chuck

    Thanks Liam, it worked. I need a clarification if you can... I don't need all the items in the menu to open in a new window, so under the menu itself, under the individual items, I would set the target frame to "_self" for the items I need to remain in the same window? Or is it an all or none thing?
    I really have appreciated the help you've given me.
    Chuck

  • Need Dynamic Table in JSP page

    Hi Friends,
    I need to build table dynamically in my JSP page.
    My requirement like:
    I have a Button in my JSP page when i click that it should go to another jsp where it will ask me the row and column counts, after i entered some values then i have a button to say OK it should go to the first page again there i want the table for the rows and columns dynamically.
    (like MS- Word when u create table it will ask the row count and column count after that its building a table)
    Please help me....

    Make use of JSTL's c:forEach.

  • Can you create a javascript dynamic menu based on security data in oracleDB

    I am looking for a dynamic javascript menu that is generated based on the user role... basically i get the user role from ldap and then I have a Security table in oracle data base that has the permission info and i want to generate my dynamic menu based on the data in the database table.... the table has the following columns
    private String userId;
    private String security_level; // page level , field level
    private String permission; //CRUD
    private String permissionType; //ALLOW, DENY

    Hello Suzie,
    It is possible but you have "many" ways to do it, since what will happen is the javascript will be generated by an application.
    Are you developing a J2EE application? with or without JSF?
    The best way will be to Google to find a good Javascript menu library, and adapt the generation of it based on the content of your database.
    Regards
    Tugdual Grall

  • Dynamic menu problem when chaning from english to arabic language

    Hi all,
          am working on Dynamic Menu its working fine in English when i convert this same menu in Arabic its working fine but the sub menu has some margin...if we set the margin then again for 2nd main menus submenu  is not coming
    in order...
    www.dreamcom.ae   (This is for english working good)
    www.dreamcom.ae/Ar/Index.aspx (This is for Arabic which is not working)
    <div class="wrap">
    <div class="content_wrap menucss">
    <%-- CssClass="menubar" --%>
    <asp:Menu ID="menuBar" StaticEnableDefaultPopOutImage="False" runat="server" Orientation="Horizontal"
    onmenuitemclick="menuBar_MenuItemClick" DynamicHorizontalOffset="2" Font-Size="18px"
    BackColor="#669903" ForeColor="White" StaticSubMenuIndent="100%" Font-Bold="True" Height="56px" vertical-align="top" top="50px"
    margin="0px" position="static" BorderStyle="None" DynamicSelectedStyle-BorderStyle="None" BorderColor="#7ab802" CssClass="menucss">
    <DynamicHoverStyle BorderStyle="Solid" BorderWidth="0px" BackColor="#7ab802" ForeColor="White" />
    <%--below single line is for sub menu --%>
    <DynamicMenuItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="0px" Font-Bold="true" Font-Size="17px" HorizontalPadding="6px" VerticalPadding="6px" />
    <%--below single line is for sub menu colour,border --%>
    <DynamicMenuStyle BorderColor="#669903" BorderStyle="Solid" BorderWidth="1px" BackColor="#669903" CssClass="menucss"/>
    <DynamicSelectedStyle BorderColor="#3094FC" BorderStyle="Solid" BorderWidth="0px" ForeColor="#3094FC" BackColor="#5D7B9D" CssClass="menucss" />
    <%--below single line is for mouse over on main menu and mouse over on sub menu --%>
    <StaticHoverStyle BorderColor="#669903" BorderStyle="Solid" BorderWidth="0px" BackColor="#7ab802" ForeColor="#ffffff" CssClass="menucss" />
    <StaticMenuItemStyle ForeColor="White" BorderStyle="Solid" BorderWidth="0px" Font-Size="14px" HorizontalPadding="15px" VerticalPadding="20px" CssClass="menucss" />
    <%--below single line is for sub menu on mouse over --%>
    <StaticSelectedStyle BorderColor="#5CB8FF" BorderStyle="Solid" BorderWidth="1px" ForeColor="#fafafa" BackColor="#5CB8FF" />
    </asp:Menu>
    </div>
    </div>
    this code am using in both english and in arabic.....but in arabic am using style="direction:rtl;" hence it the direction of the content will change...
    and am fetching english and arabic datas are fetch from database..
    Kindly help me out...am trying from long time..
    Thanks.

    Hi,
    This is a ASP.NET question so I think you need to submit the question at:
    http://forums.asp.net/

  • How to create two level dynamic list using JSP , Java Script and Oracle

    I am new in JSP. And i am facing problem in creating two level dynamic list using JSP ,Java Script where the listdata will come from Oracle 10g express edition database. Is there any easy way in JSP that is available on in ASP.NET.
    Plz response with details.

    1) Learn JDBC API [http://java.sun.com/docs/books/tutorial/jdbc/index.html].
    2) Create DAO class which contains JDBC code and do all SQL queries and returns or takes ID's or DTO objects.
    3) Learn Servlet API [http://java.sun.com/javaee/5/docs/tutorial/doc/].
    4) Create Servlet class which calls the DAO class, gets the list of DTO's as result, puts it as a request attribute and forwards the request to a JSP page.
    5) Learn JSP and JSTL [http://java.sun.com/javaee/5/docs/tutorial/doc/]. Also learn HTML if you even don't know it.
    6) Create JSP page which uses the JSTL c:forEach tag to access the list of DTO's and iterate over it and prints a HTML list out.
    You don't need Javascript for this.

Maybe you are looking for

  • How can i convert .mov to .mp4?

    Hello again I have made a large promo dvd for an upcoming seminar and the national organization would like to put it on its website. I broke it down into chapters so that it is not one long cumbersome piece, and visitors can watch just the parts they

  • Automation of Intercompany AP/AR clearing process

    Hi Can you please tell me if we can automate Intercompany AP/AR clearing in ECC and if we can can you please provide the necessary guidance/configuration steps involved. your help is very much appreciated. Thanks and Regards RG

  • ABAP Object Using standard BAPI

    When running ABAP program to convert Accounts Payable conversion documents, the program results indicate the document in the load program were created and returns the relevant document numbers.  However when validating the documents in BKPF, BSEG, or

  • How to use the .ase files?

    As a test I imported a few Kuler .ase files into Illustrator CS2. They appear to be spot RGB colors all labelled Unnamed Global Color, which clash when I drag in a second lot. I made 2 files, one set to RGB, the other to CMYK. In the RGB file the col

  • G5 Dual 1.8 issues

    Hi, I'm running a dual 1.8 ghz G5. started having "you must shut down your computer" messages, kernal panics, and high revving fans with freeze-ups. Still runs fine if only on the web, but if I try FCP (or any other memory intensive programs) that's