在春季用支柱突出显示所选菜单 [英] Highlight the selected menu in spring with struts

查看:55
本文介绍了在春季用支柱突出显示所选菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何方法可以突出显示已被选中的当前菜单.我正在使用left-mnu.jsp,其中我拥有每个jsp页面中包含的所有菜单.现在我使用单击的变量并对此进行更新当我打开jsp主页面时,将变量设置为某个值.然后在left-menu.jsp中检查此变量以突出显示适当的菜单.我知道这不是一个好方法.有人可以建议我一个突出显示菜单的好方法./p>

Is there any way to highlight the current menu which have been clciked.I am using left-mnu.jsp in which i have all the menu which i am including in each jsp pages.Now i use a variable clicked and update this variable to some value when i open main jsp pages.Then am checking this variable in left-menu.jsp to highlight the appropriate menu.I know this is not a good approach.Can any one suggest me a good one for highlighting menu.

推荐答案

您只能使用CSS来做到这一点,使用与所选菜单项的ID相关的单词来设置房屋的ID,例如此处.

You can do that with CSS only, setting the id of the home with a word related to the id of the selected menu item, like described here.

或使用Javascript,将当前页面的URL与菜单项的URL(如果它们为href)进行匹配,如

Or with Javascript, matching the URL of the current page with the URL of the menu items (if they're href), like described here (approach #2)

或者使用JSP标记等...

Or do it with JSP tags, etc...

这篇关于在春季用支柱突出显示所选菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆