我有一个Request Scoped Managed Bean,我在其中执行JPA查找以从数据库填充属性。当我离开页面并对数据库记录进行更改时,它不反映我何时重新访问应该显示更改的页面,即带有@PostContruct的Managed Bean类从数据库加载。
ManagedBean:
@PostConstruct
public void loadCurrentProfile() {
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext externalContext = context.getExternalContext();
Long id = (Long) externalContext.getSessionMap().get("id");
serviceprovider = em.find(Serviceprovider.class, id);
}
<managed-bean>
<managed-bean-name>companyProfileBean</managed-bean-name>
<managed-bean-class>com.suntech.winnoweb.jsfbeans.CompanyProfileBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>id</property-name>
<value>#{param.id}</value>
</managed-property>
</managed-bean>