我将primefaces Tree Componemt用作导航器,该导航器根据所选的节点通过ajax调用来加载Center / Main Content。
当我通过Eclipse运行代码时,代码工作正常,但是在部署到Google App Engine后尝试相同的代码时,appengine上根本没有调用nodeSelect事件列表器

menu.xhtml

<h:form id="adminForm" styleClass="formStyle">
    <p:growl id="adminMessage" showDetail="true" />
    <p:tree value="#{adminMenuBean.root}" var="node"
        selectionMode="single" >
        <p:ajax event="select" listener="#{adminMenuBean.onNodeSelect}"
             process="@this" update=":main" dynamic="true"/>
        <p:treeNode id="adminTreeNode">
            <h:outputText value="#{node}" id="lblNode" />
        </p:treeNode>
    </p:tree>
</h:form>


AdminMenuBean.java(托管Bean)

@ManagedBean(name = "adminMenuBean")
@SessionScoped
public class AdminMenuBean implements Serializable {

private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(AdminMenuBean.class
        .getName());

private String name;
private String caddress;
private Date dob;
private Long mobileno;
private double uniqueno = 0;

private String navigationUrl = "UserRequest";

private TreeNode root;

public TreeNode getRoot() {
    return root;
}

public AdminMenuBean() {
    root = new DefaultTreeNode("root", null);

    TreeNode admin = new DefaultTreeNode("Admin", root);
    TreeNode UserRequest = new DefaultTreeNode("User Request", admin);
    TreeNode ManageUser = new DefaultTreeNode("Manage User", admin);

    TreeNode DocumentManagement = new DefaultTreeNode(
            "Document Management", root);
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getCaddress() {
    return caddress;
}

public void setCaddress(String caddress) {
    this.caddress = caddress;
}

public Date getDob() {
    return dob;
}

public void setDob(Date dob) {
    this.dob = dob;
}

public Long getMobileno() {
    return mobileno;
}

public void setMobileno(Long mobileno) {
    this.mobileno = mobileno;
}

public double getUniqueno() {
    uniqueno = uniqueno + Math.random();
    return uniqueno;
}

public void setUniqueno(double uniqueno) {
    this.uniqueno = uniqueno;
}

public String getNavigationUrl() {
    return navigationUrl;
}

public void setNavigationUrl(String navigationUrl) {
    this.navigationUrl = navigationUrl;
}

public void onNodeSelect(NodeSelectEvent event) {
    log.info("node select"+ navigationUrl);
    if (event.getTreeNode().getParent().toString() != "root"
            || event.getTreeNode().getData().toString() == "Document Management") {
        String url = event.getTreeNode().getData().toString();
        try {
            url = url.replaceAll(" ", "");
            System.out.println("url-->" + url);
            this.setNavigationUrl(url);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
}


我的项目依存关系


Primefaces 3.4
JDK 1.6
JSF 2.0
Appengine SDK版本1.7.4

最佳答案

我在带有树的primeface版本3.4中遇到问题
通过升级到3.5,我的问题得以解决。
对你来说可能是一样的情况:)

关于java - 在Tree Component中的select事件上未调用Primefaces ajax监听器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16813820/

10-14 09:46