开发者

In jsf, can i inject a sessionscope bean into an actionlistener?

In jsf, I want to inject a sessionsc开发者_如何学运维ope bean into an actionlistener implementation. Can it be done?


Like this:

YourBean testBean = (YourBean)FacesContext.getCurrentInstance().getExternalContext()
               .getSessionMap().get( "yourBean");


go through this..

http://www.oio.de/public/java/jsf-best-practices-javaserver-faces-session-tips.htm

or

    ELContext elContext = context.getELContext();
    context.getApplication().getExpressionFactory()
       .createValueExpression(elContext,"#{sessionScope.sessionValue}", String.class)
       .setValue(elContext, this.getSessionValue());
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜