0 Replies Latest reply: Apr 25, 2012 6:25 AM by Thor-K RSS

@ViewConfig with @UrlMapping and EL-injected path parameters

Thor-K Newbie

Hello, I have a simple @ViewConfig:





wich should set a String into a @Named Bean with EL-injected path paramter (http://ocpsoft.org/docs/prettyfaces/3.3.2/en-US/html/Configuration.html#config.pathparams.el):


@Named @RequestScoped

public class LinkBean implements Serializable


    private String token;

    public String getToken() {return token;}

    public void setToken(String token) {this.token = token;logger.info("SET "+token);}



  public void init() throws FileNotFoundException

  {logger.info("@PostConstruct: "+token); }



  public void close() throws FileNotFoundException

  {logger.info("@PreDestroy: "+token); }



Actually this is working, but not in the ordering I expect:


12:08:02,625 INFO  [LinkBean] (http-- @PostConstruct: null

12:08:02,626 INFO  [LinkBean] (http-- SET 123

12:08:02,677 INFO  [LinkBean] (http-- @PreDestroy: 123


The parameter is set *after* the @PostConstruct? In my understanding (citing from http://stackoverflow.com/questions/1804778/jsf-1-2-does-postconstruct-execute-before-or-after-getters)


  1. Bean is constructed.
  2. Managed properties are set.
  3. @PostConstruct is called.
  4. Bean is brought in JSF lifecycle.

Is this normal behaviour? How can I access the paramater in the @PostConstruct method?