Hi !

I'm playing with @PostConstruct annotation and JSF. In fact I'm
following this article
http://weblogs.java.net/blog/jhook/archive/2007/05/jsf_12_ri_backi.html
. With Sun RI implementation all is working just fine, but not with
MyFaces. I'm a little bit confused. I've noticed that PostConstruct
annotated method is executed before request param is injected.
The source code I'm plaing with is
http://svn.apache.org/repos/asf/myfaces/current12/test-webapp, so
MyFaces version is 1.2.3-SNAPSHOT

public class HelloWorldBacking {
....
        private Integer pid; //injected request param

        public Integer getPid()
        {
                return this.pid;
        }
        public void setPid(Integer pid)
        {
                this.pid = pid;
        }
    @PostConstruct()
    public void postConstruct() {
        System.out.println("Injected request param : "+pid);
    }
.....
}

<managed-bean>
                <managed-bean-name>helloWorldBacking</managed-bean-name>
                
<managed-bean-class>org.apache.myfaces.blank.HelloWorldBacking</managed-bean-class>
                <managed-bean-scope>request</managed-bean-scope>
                <managed-property>
                         <property-name>pid</property-name>
                         <property-class>java.lang.Integer</property-class>
                         <value>#{param.pid}</value>
                </managed-property>
</managed-bean>

Any ideas ?

Reply via email to