In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The editor today takes you to understand what points you should pay attention to when using struts menu in Struts2. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article together with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn more about "what points to pay attention to when using struts menu in Struts2".
Struts menu in Struts1.0
Menu-config.xml is the menu configuration file!
Add the following code to the struts-config.xml file of struts1.2:
The parameter is: menuConfig corresponding value is: menu configuration file path!
Struts menu in Struts2.0
In the menu-config.xml file
Note that when adding entries, be sure to modify the Item name attribute, do not repeat, otherwise it will not be displayed properly!
Struts menu in Struts3.0
Configure struts-menu in struts2
In the past, you needed to configure in struts-config.xml in struts1.x to introduce struts-menu, but now you only need to configure a listener in web.xml.
Net.sf.navigator.menu.MenuContextListener
-MenuContextListener.java partial source code:-
Public class MenuContextListener implements ServletContextListener {
Private static Log log = LogFactory.getLog (MenuContextListener.class)
Private ServletContext ctx
Private String menuConfig = "/ WEB-INF/menu-config.xml"
Public void contextInitialized (ServletContextEvent sce) {
Ctx = sce.getServletContext ()
If (log.isDebugEnabled ()) {
Log.debug ("Starting struts-menu initialization")
}
/ / check for menuConfigLocation context-param
String override =
Sce.getServletContext () .getInitParameter (menuConfigLocation)
If (override! = null) {
If (log.isDebugEnabled ()) {
Log.debug ("using menuConfigLocation:" + override)
}
This.menuConfig = override
}
MenuRepository repository = new MenuRepository ()
Repository.setLoadParam (menuConfig)
.
This is much more comfortable compared to the way plug-ins are loaded in struts1, but the menu configuration file in struts2 must be: menu-config.xml
You can name it yourself in struts1!
Thank you for your reading. The above is the whole content of "what points to pay attention to when using struts menu in Struts2". Friends who learn to learn to do it quickly. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.