Primefaces在f:setPropertyActionListener之前更新面板

时间:2015-09-21 08:37:05

标签: jsf primefaces managed-bean

我有以下托管bean,它具有selectedElement属性,并且在自动更新outputpanel内绑定到它的primefaces视图中的一些组件,我有commandButton和{{1设置f:setPropertyActionListener然后更新面板,我得到selectedElement 我认为更新程序在设置属性之前触发,我在不同页面中有另一个视图执行相同的过程而没有错误! 托管bean代码是:

Target Unreachable, 'null' returned null: javax.el.PropertyNotFoundException:

,视图是:

package boddooo.service;

import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.transaction.UserTransaction;

import boddooo.entity.Element;

@ManagedBean(name="ob")
@SessionScoped
public class objectsbuilder {

UserTransaction ut=null;

@PersistenceContext(unitName="game")
private EntityManager em;

Context icontext=null;
public objectsbuilder() throws NamingException{
    icontext=new InitialContext();
    ut=(UserTransaction)icontext.lookup("java:comp/UserTransaction");
}

private List<Element> elements;

private Element selectedElement;

public Element getSelectedElement() {
    return selectedElement;
}

public void setSelectedElement(Element selectedElement) {
    this.selectedElement = selectedElement;
}

@SuppressWarnings("unchecked")
public void loadElements(){
    Query q=em.createNamedQuery("Element.findAll");
    elements=(List<Element>)q.getResultList();
}

public List<Element> getElements(){
    return elements;
}

}

0 个答案:

没有答案