I have a java.util.List in jsp page which contains menuIds. Each menu Item is mapped to menuId and based on menuId user has access to view the page else the page/menu should be hidden so that user should not see that menu name in the dropdown menu. How can i achieve this, please suggest.Below is the code:

jsp code:
Code:
            <script type="text/javascript" src="/js/menu.js"></script>
    //code
            java.util.ArrayList<Integer> accessList = (java.util.ArrayList<Integer>) session.getAttribute("AccessList");
        //accessList has pageId's
menu.js

Code:
   require(["dijit/MenuBar",
    		 	         "dijit/PopupMenuBarItem",
    		 	         "dijit/Menu",
    		 	         "dijit/MenuItem",
    		 	         "dijit/DropDownMenu",
    		 	         "dojo/domReady!"
    		 	     ],function(MenuBar, PopupMenuBarItem, Menu, MenuItem, DropDownMenu){
    		 	         var pMenuBar = new MenuBar({
    		 	        	
    		 	         });
    		
    		 	         
    		 	        dijit._MenuBase.prototype.onItemHover = function(item){
    		 	         	this.focusChild(item);
    		 				if(this.focusedChild.popup && !this.focusedChild.disabled){
    		 					this._openPopup();
    		 				}
    		 			};
    
    		 	         var pSubMenu = new DropDownMenu({});
    		 	        
    		 	         pSubMenu.addChild(new MenuItem({
    		 	             label: "SIDs",
    		 	             onClick:function(){window.location.href=contextPath+"/jsp/index.jsp"}
    		
    		 	             }));
    		 	         pSubMenu.addChild(new MenuItem({
    		 	             label: "SID Requests",
    		 	             onClick:function(){window.location.href=contextPath+"/jsp/SIDRequests.jsp";
    		 	             					pSubMenu.close();}
    		 	             }));
    		 	         pMenuBar.addChild(new PopupMenuBarItem({
    		 	             label: "Tab1",
    		 	             popup: pSubMenu
    		 	         }));
    		 	         
    		 	         var pSubMenu2 = new DropDownMenu({});
    		 	         pSubMenu2.addChild(new MenuItem({
    		 	             label: "SpreadReq",
    		 	             onClick:function(){window.location.href=contextPath+"/calculateSpread.htm"}
    		 	         }));
    		 	          pSubMenu2.addChild(new MenuItem({
    		 	             label: "WinRequest",
    		 	             onClick:function(){window.location.href=contextPath+"/createWinRequest.htm"}
    		 	         }));
    		 	          pSubMenu2.addChild(new MenuItem({
    		 	             label: "Show SID",
    		 	             onClick:function(){window.location.href=contextPath+"/showSID.htm"}
    		 	         }));  
    		 	         pMenuBar.addChild(new PopupMenuBarItem({
    		 	             label: "| Tab2",
    		 	             popup: pSubMenu2
    		 	         }));
    		 				
    		 	         
    		  
    		 	      
    		 	         pMenuBar.placeAt("wrapper");
    		 	         pMenuBar.startup();
    		 	     });
How can i check in menu.js whether the user logged in has access to the menu so that if he has no access that menu item should be hidden/disabled. "accessList" in jsp page has menuID's. Please suggest.