在jsf中,我想将一个sessionscope bean注入一个actionlistener实现。可以吗?
答案 0 :(得分:2)
像这样:
YourBean testBean = (YourBean)FacesContext.getCurrentInstance().getExternalContext()
.getSessionMap().get( "yourBean");
答案 1 :(得分:0)
通过这个..
http://www.oio.de/public/java/jsf-best-practices-javaserver-faces-session-tips.htm
或
ELContext elContext = context.getELContext();
context.getApplication().getExpressionFactory()
.createValueExpression(elContext,"#{sessionScope.sessionValue}", String.class)
.setValue(elContext, this.getSessionValue());