PostConstruct « Development « JSF Q&A

1. Problem with @ViewScope and the @PostConstruct

My MBean is @ViewScope and the @PostConstruct is called when new instance is created and when made ajax request. this should happen?

2. @PostConstruct for @ManagedProperty

Hi I have this issue of @PostConstruct method not getting called inside a bean annotated with @ManagedProperty inside another bean. Below is the example:

public class BeanA{
@ManagedProperty (value="#{beanB}")
private BeanB beanB;

// BeanB setter ...

3. How to keep the variable alive in PostConstruct

In my application methods are calling more than twice to avoid this I tried to populate the users list based on some conditions in PostConstruct method. The bean variable 'enabled' has ...

4. Initialize h:selectOneMenu before it is shown

I have the access page where I check for a valid user, if it exists then pass to the next page and create a

String[] options;
based on the typeOfUser. So if user ...

5. @PostConstruct ,@Preestroy

6. JSF 1.2 @PostConstruct not working

Originally posted by Gaurav Ram: Hi, I want to use JSF 1.2 @PostConstruct annotation and for that i have downloaded latest version of JSF i.e. JSF 1.2 and also i configured Tomcat 6.x.x in my MyEclipse, but when i am using @PostConstruct in Bean it is giving compile time error,, it is not recognizing that package,,, can you please help me ...

7. Using @PostConstruct in an abstract class

Hello. Is it possible to use @PostConstruct annotation on a non-abstract method of an abstract class? In our application the annotation works perfectly if is placed on a method of a managed bean. But it doesn't work if I pull it up in the class hierarchy. For example: public abstract class AbstractParentBean { public AbstractParentBean() { super(); } @PostConstruct public void ...

8. @PostConstruct not working

9. @PostConstruct dont work