req.getSession().setAttribute("language", locale.getLanguage());
if (webUser != null) {
/* create menu once and store it in session (required because otherwise no menu is created when struts validation re-displays a page)
* menu is recreated if current locale differs from language in session (happens, when user switches language)
*/
MenuManager menuManager = new MenuManager(locale, session);
if (req.getSession().getAttribute("sysMenuItems") == null || !locale.getLanguage().equals(req.getSession().getAttribute("language"))) {
Set<Menu> menu = menuManager.createMenu(webUser);
List<DisplayableMenuItem> displayableMenu = new ArrayList<DisplayableMenuItem>(10);
for (Menu m : menu) {
displayableMenu.add(new DisplayableMenuItem(m, locale));
}
req.getSession().setAttribute("sysMenuItems", displayableMenu);