|
|
|
[
Permlink
| « Hide
]
Matt Raible - 19/Sep/06 06:49 PM
Can you provide a link to which menu you're using at http://demo.raibledesigns.com/struts-menu? Can you reproduce the behavior on the demo app? Do you have a small sample app you can send so I can try to reproduce locally? I need to reproduce the problem in order to fix it. ;-)
Hello Matt,
Thank you for the reply. I've attached a small webapp that illustrate my problem. Basically, if the user click "submenu1" (which expand "menu1") and then click the logout link, user will be brought forward to the login page (in a normal struts app, I will bring them to the logout action which does things like session.invalidate()). If the user logs back in, "menu1" stays expanded, and "submenu1" stays highlighted. Again, this seems to be a problem with stored cookie.. Thanks in advance for the helps! Regards, Alex. Yes, this is caused by the "hightlight" cookie in the following code:
function expandMenus() { var menusToExpand = getCookie(menuCookie); if( menusToExpand != null ) { // if more than one menu has been menusToExpanded, // create an array of menusToExpanded menus if( menusToExpand.indexOf(",") != -1 ) { menuArray = menusToExpand.split(","); for( var i = 0; i < menuArray.length; i++ ) { openMenu(menuArray[i]); } } else { openMenu(menusToExpand); } } var itemToHighlight = getCookie(itemCookie); var links = document.getElementsByTagName("a"); // add an onclick event to set a cookie on the non-actuators for( i = 0; i < links.length; i++ ) { if( links[i].href == itemToHighlight ) { links[i].className += " highlight"; } } } Adding an "onclick" attribute to the logout menu seems to fix the problem. <Menu name="logoutMenu" title="Logout" location="login.do" onclick="deleteCookie(itemCookie)"/> Another option would be to remove the "itemToHighlight" cookie in your logout handler. Matt |
|||||||||||||||||||||||||||||||||||||||||||||