richfaces panelMenu当双重选择相同的menuItem时会丢失页面格式

时间:2013-09-09 07:57:37

标签: jsf richfaces

我有使用richfaces panelMenu的非常奇怪的行为,如果我选择两次相同的menù项目,中间没有其他操作,页面将丢失所有格式。 我正在使用rf 4.3.2并且我已经使用firefox 23和10进行了测试。 这是第一个选择 enter image description here

这是第二个 enter image description here

任何提示都将受到赞赏

menu.xhtml:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:rich="http://richfaces.org/rich">
<h:form id="menuForm">
  <rich:panelMenu style="width:200px; background: white"  itemMode="server" groupMode="ajax"
            groupExpandedLeftIcon="triangleUp" groupCollapsedLeftIcon="triangleDown"
                    topGroupExpandedRightIcon="chevronUp" itemLeftIcon="disc"
                    topGroupCollapsedRightIcon="chevronDown">
        <rich:panelMenuGroup label="#{menu.menuGroup1}" >
    <rich:panelMenuItem label="#{menu.menuItem11}" action="#{menuBean.getCurAction}" >
                <f:param name="curVal" value="11"/>
            </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem12}" action="#{menuBean.getCurAction}" >
                <f:param name="curVal" value="12"/>
            </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem13}" action="#{menuBean.getCurAction}" >
                <f:param name="curVal" value="13"/>
            </rich:panelMenuItem>
   <rich:panelMenuItem label="#{menu.menuItem14}" action="#{menuBean.getCurAction}" >
                <f:param name="curVal" value="14"/>
            </rich:panelMenuItem>
            <rich:panelMenuGroup label="#{menu.menuGroup15}" >
    <rich:panelMenuItem label="#{menu.menuItem151}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="151"/>
                </rich:panelMenuItem>
   <rich:panelMenuItem label="#{menu.menuItem152}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="152"/>
                </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem153}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="153"/>
                </rich:panelMenuItem>
            </rich:panelMenuGroup>
        </rich:panelMenuGroup>
        <rich:panelMenuGroup label="#{menu.menuGroup2}">
     <rich:panelMenuItem label="#{menu.menuItem21}" action="#{menuBean.getCurAction}" >
                <f:param name="curVal" value="21"/>
            </rich:panelMenuItem>
     <rich:panelMenuItem label="#{menu.menuItem22}" action="#{menuBean.getCurAction}" >
                <f:param name="curVal" value="22"/>
            </rich:panelMenuItem>
     <rich:panelMenuItem label="#{menu.menuItem23}" action="#{menuBean.getCurAction}" >
                <f:param name="curVal" value="23"/>
            </rich:panelMenuItem>
     <rich:panelMenuItem label="#{menu.menuItem24}" action="#{menuBean.getCurAction}" >
                <f:param name="curVal" value="24"/>
            </rich:panelMenuItem>
            <rich:panelMenuGroup label="#{menu.menuGroup25}" >
    <rich:panelMenuItem label="#{menu.menuItem251}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="251"/>
                </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem252}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="252"/>
                </rich:panelMenuItem>
            </rich:panelMenuGroup>
        </rich:panelMenuGroup>
        <rich:panelMenuGroup  label="#{menu.menuGroup3}">
            <rich:panelMenuGroup label="#{menu.menuGroup31}" >
    <rich:panelMenuItem label="#{menu.menuItem311}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="311"/>
                </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem312}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="312"/>
                </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem313}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="313"/>
                </rich:panelMenuItem>
            </rich:panelMenuGroup>
            <rich:panelMenuGroup label="#{menu.menuGroup32}" >
    <rich:panelMenuItem label="#{menu.menuItem321}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="321"/>
                </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem322}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="322"/>
                </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem323}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="323"/>
                </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem324}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="324"/>
                </rich:panelMenuItem>
            </rich:panelMenuGroup>
            <rich:panelMenuGroup label="#{menu.menuGroup33}" >
    <rich:panelMenuItem label="#{menu.menuItem331}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="331"/>
                </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem332}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="332"/>
                </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem333}" action="#{menuBean.getCurAction}" >
                    <f:param name="curVal" value="333"/>
                </rich:panelMenuItem>
            </rich:panelMenuGroup>
        </rich:panelMenuGroup>
     <rich:panelMenuItem label="#{menu.menuItem98}" action="#{menuBean.getCurAction}" >
            <f:param name="curVal" value="98"/>
        </rich:panelMenuItem>
    <rich:panelMenuItem label="#{menu.menuItem99}" action="#{menuBean.optionLogout}" >
            <f:param name="curVal" value="99"/>
        </rich:panelMenuItem>
    </rich:panelMenu>
</h:form>
</ui:composition>

菜单bean

package bean;

import bean.util.JsfUtil;
import entities.ESMenuAction;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.TreeMap;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import org.richfaces.component.UIPanelMenuGroup;
import uty.ESMessageManager;
import uty.ESUty;

@ManagedBean(name = "menuBean")
@SessionScoped
public class ESMenuBean implements Serializable {

final String sMenuConst4Action = "menuAction", sMenuConst4Item = "menuItem";
HashMap<String, String> hmKeys = null;
TreeMap<String, ESMenuAction> tm = null;
Locale curLoc;

public ESMenuBean() {
    ResourceBundle rb;
    try {
        rb = ResourceBundle.getBundle("properties.menu");
    } catch (Throwable t) {
        ESUty.getSystemLogger().setMsg4Error("ESMenuBean Error Accessing properties.menu Resource Bundle - " + t);
        return;
    }
    loadMenuItems(rb);
    curLoc = ESUty.getCurLocale();
    rb = null;
}

public String getCurAction() {
    String s = tm.get(getCurOption()).getMenuAction();
    if (s.equals("ESTipReco_list") && !ESUty.getESUserRights().isAdmin()) {
        JsfUtil.addMessage(ESMessageManager.getMessageNoLog("errMenuOptNotAllowed", FacesMessage.SEVERITY_ERROR, curLoc));
        ESUty.getSystemLogger().setMsg4Info("ESMenuBean.getCurAction Menu' Option " + s + " not Allowed for " + ESUty.getESUserCur().getU1usr());
        return null;
    }
    if (ESUty.getESUserRights().isAut4Menu(s)) {
        ESUty.getSystemLogger().setMsg4Info("ESMenuBean.getCurAction Menu' Option " + s + " Selected for " + ESUty.getESUserCur().getU1usr());
        return s;
    }
    JsfUtil.addMessage(ESMessageManager.getMessageNoLog("errMenuOptNotAllowed", FacesMessage.SEVERITY_ERROR, curLoc));
    ESUty.getSystemLogger().setMsg4Info("ESMenuBean.getCurAction Menu' Option " + s + " not Allowed for " + ESUty.getESUserCur().getU1usr());
    return null;
}

private String getCurOption() {
    return JsfUtil.getRequestParameter("curVal");
}

public ESMenuAction getMenuObject(String inMenuAction) {
    try {
        return tm.get(hmKeys.get(inMenuAction));
    } catch (Throwable t) {
        return null;
    }
}

public SelectItem[] getMenuItemsAvailableSelectOne() {
    return JsfUtil.getSelectItems(new ArrayList(tm.values()), true);
}

private void loadMenuItems(ResourceBundle inRb) {
    try {
        tm = new TreeMap();
        hmKeys = new HashMap();
        Enumeration<String> en = inRb.getKeys();
        while (en.hasMoreElements()) {
            String sKey = en.nextElement();
            if (!sKey.startsWith(sMenuConst4Item)) {
                continue;
            }
            String sMenuOption = sKey.substring(sMenuConst4Item.length());
            tm.put(sMenuOption,
                    new ESMenuAction(inRb.getString(sMenuConst4Action + sMenuOption),
                    inRb.getString(sKey),
                    sMenuOption));
            hmKeys.put(inRb.getString(sMenuConst4Action + sMenuOption), sMenuOption);
        }
    } catch (Throwable t) {
        ESUty.getSystemLogger().setMsg4Info("ESMenuBean.loadMenuItems Error Loading Menu' Items " + t);
    } finally {
    }
}

public String optionLogout() {
    ESUty.getSystemLogger().setMsg4Info("ESMenuBean.optionLogout Session Closed for " + ESUty.getESUserCur().getU1usr());
    uty.ESUtil.logout();
    return tm.get("99").getMenuAction();
}
}

0 个答案:

没有答案