@Override
public ActionForward execute(ActionMapping mapping, MenuForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
Menu menu = (Menu)request.getSession().getAttribute(Globals.MENU_KEY);
MenuItem menuItem = null;
if(menu == null)
{
if(log.isDebugEnabled())
log.debug("no menu found in session");
// not protected by rights -> write error and go to login manually
ActionMessages errors = new ActionMessages();
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.common.error.notLoggedIn"));
saveErrors(request, errors);
}
else
{
menuItem = menu.activate(form.getMenuId());
if(menuItem == null)
{
menuItem = menu.getActiveItem();
if(log.isDebugEnabled())
log.debug("could not activate menu item / use active item: "+menuItem);
}
else if(log.isDebugEnabled())
log.debug("activate item: "+menuItem);
// do always delete the stack when click the menu
PanelStack panelStack = Panel.getPanelStack(request);
panelStack.clear();
return Panel.getForward(menuItem.getAction(), request);
}
return mapping.findForward("login");
}