开发者

action-to-action navigation in JSF 2

I'm migrating from weblogic (struts extension) to JSF2.

I wonder how can I navigate form one bean action to anoth开发者_高级运维er bean action. In weblogic, I would create and initialize form bean and I would return new Forward pointing to another action.

How can I do the same in JSF?


This is not a normal practice in JSF. You would like to refactor the business logic out so that it can just be obtained/reused by multiple models (managed beans) independently.

Regardless, here's how you could do it: just inject the "other" action bean as managed property and invoke it in the current bean's action method:

@ManagedProperty(value="#{otherBean}")
private OtherBean otherBean;

public String doSomething() {
    return otherBean.doSomethingElse();
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜