managed-bean

change rendered attribute from managed bean

自作多情 提交于 2019-12-06 15:33:43
问题 Im am experimenting a bit with JSF, the scenario is the following: I have a session scoped managed bean @ManagedBean(name = "rand") @SessionScoped where i have declared the following (among other things): private UIOutput uiOutput;(plus getter and setter) In my facelets page i have <h:outputLabel for="userGuess" binding="#{rand.uiOutput}" value="#{rand.listSize}" rendered="false"/> there is a button on the page, and on the action method of the button among other things i have this.uiOutput

What makes a bean a CDI bean?

笑着哭i 提交于 2019-12-06 13:43:15
问题 In the top answer to this question for example : Java EE 6 @javax.annotation.ManagedBean vs. @javax.inject.Named vs. @javax.faces.ManagedBean I read that: To deploy CDI beans, you must place a file called beans.xml in a META-INF folder on the classpath. Once you do this, then every bean in the package becomes a CDI bean. And also it is said that: If you want to use the CDI bean from a JSF page, you can give it a name using the javax.inject.Named annotation. I have a sample code that goes like

JSF (and PrimeFaces) How to pass parameter to a method in ManagedBean

随声附和 提交于 2019-12-06 11:36:05
问题 I have an Employee object I am showing in inputtext. For example, the firstname of the employee is shown in an inputtext. When the value of this firstname changes it calls a method. Before this is done I want to call a method which saves the ID of the employee in the managedbean so I know which employee needs to be changed. How do I do this, I got this so far: <h:outputText value="First name:"/> <p:inplace id="firstname" editor="true"> <p:ajax event="save" onsuccess="#{employeeController

session-scoped managed bean appears to be not session scoped in an xpages application

↘锁芯ラ 提交于 2019-12-06 06:55:43
问题 I'd wrote a session scoped managed bean to cache the sesion user specific info in a domino xpages application,just like the following codes: public class NBUserInfo { private String fullUserName; private String commonUserName; private String displayName; private String mailAddress; private String themeType; private String themeData; private Session _session; private Database _dbnames; private Name _dominoName; public NBUserInfo(){ System.out.println("初始化Managed Bean:NBUserInfo..."); _session

Can @ManagedPropery and @PostConstruct be placed in a base class?

喜夏-厌秋 提交于 2019-12-06 03:36:17
问题 I'm using a hierarchy of classes and what I would optimally try to do is have @ManagedBean 's that inherit a class that have @ManagedProperty members and @PostConstruct methods. Specifically, will this work? : public class A { @ManagedProperty private C c; @PostConstruct public void init() { // Do some initialization stuff } public C getC() { return c; } public void setC(C c) { this.c = c; } } @ManagedBean @SessionScoped public class B extends A { // Content... } Thanks in Advance! 回答1: The

ManagedProperty of SessionScope inside a ViewScoped Bean - Transient?

限于喜欢 提交于 2019-12-06 01:37:17
问题 I have a JSF Beans structure of this sort: @ManagedBean @ViewScoped public class ViewBeany implements Serializable { .... @ManagedProperty(value='#{sessionBeany}) transient private SessionBeany sessionBeany; ... public getSessionBeany() { ... }; public setSessionBeany(SessionBeany sessionBeany) { ... }; } The reason for the transient is that the session bean has some non-Serializable members and cannot be made Serializable. Will this work? If not, How can I solve the problem of not being able

change rendered attribute from managed bean

若如初见. 提交于 2019-12-04 20:55:37
Im am experimenting a bit with JSF, the scenario is the following: I have a session scoped managed bean @ManagedBean(name = "rand") @SessionScoped where i have declared the following (among other things): private UIOutput uiOutput;(plus getter and setter) In my facelets page i have <h:outputLabel for="userGuess" binding="#{rand.uiOutput}" value="#{rand.listSize}" rendered="false"/> there is a button on the page, and on the action method of the button among other things i have this.uiOutput.setRendered(true); But it does not seem to work, the element will not be rendered. If a start it as

Serialization of ManagedProperty

我只是一个虾纸丫 提交于 2019-12-04 17:43:40
We have the following problem with JSF's @ViewScoped and @ManagedProperty : we have ManagedBean s that basically look as follows: @ManagedBean @SessionScope public class SessionConfig implements Serializable { // ... } and @ManagedBean @ViewScope public class SomeController implements Serializable { @ManagedProperty( value="#{sessionConfig}" ) private SessionConfig sessionConfig; // public getter and setter // ... } The controller is serialized after the request has been processed, as expected. I expected that the @ManagedProperty sessionConfig would be handled specially in serialization, in

JSF (and PrimeFaces) How to pass parameter to a method in ManagedBean

无人久伴 提交于 2019-12-04 16:50:25
I have an Employee object I am showing in inputtext. For example, the firstname of the employee is shown in an inputtext. When the value of this firstname changes it calls a method. Before this is done I want to call a method which saves the ID of the employee in the managedbean so I know which employee needs to be changed. How do I do this, I got this so far: <h:outputText value="First name:"/> <p:inplace id="firstname" editor="true"> <p:ajax event="save" onsuccess="#{employeeController.saveName()}"/> <p:inputText id="firstName" value="#{emp.firstName}" required="true" label="text"

Injecting same EJB into two different managed beans not working

眉间皱痕 提交于 2019-12-04 14:55:53
问题 I have a stateless EJB and two different SessionScoped managed beans. e.g. EJB as follows - @Stateless public classs MyEjb implements MyEjbLocal { @PersistentContext(unitName="myPU") private EntityManager em; and a managed bean - @ManagedBean @SessionScoped public class MyBean1 implements Serializable { @EJB private MyEjbLocal myEjb; and another managed bean - @ManagedBean @SessionScoped public class MyBean2 implements Serilizable { @EJB private MyEjbLocal myEjb; private List<MyEntity>