在jsf中,我想将会话作用域bean注入到actionlistener实现中。能做到吗?
像这样:
YourBean testBean = (YourBean)FacesContext.getCurrentInstance().getExternalContext()
.getSessionMap().get( "yourBean");
执行此操作。。
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());