开发者

@ManagedProperty injected AFTER @PostConstruct

THIS PROBLEM IS ALREADY SOLVED开发者_运维技巧 IN THE MYFACES 2.1 IMPLEMENTATION

I have a link which passes an Integer parameter properly like this:

<h:link outcome="/process/createProcess">
    <f:param name="id" value="#{process.idprocess}" />
    Edit
</h:link>

It goes to "createProcess.xhtml?id=21" properly, and I have this code in the request scope backing Bean createProcess:

@ManagedProperty(value="#{param.id}")
private Integer idProcess;

private Process newProcess;

@PostConstruct
public void init()
{
    log();
    if (idProcess!=null)
        newProcess = Dao.getProcessDAO().get(idProcess);
    else
        newProcess = new Process();
}

I've notice that idProcess is always null. After debugging I realized that setIdProcess method is called AFTER @PostConstruct.

I understand that injection is done just after the construction of the bean and all the managedProperties are available in @PostConstruct.

What am I missing?


Just for reference, I think the issue in this post is MYFACES-3116, with was already fixed at , so 2.0.6, 2.1.0 and upper versions does not have it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜