-
-
Save bertomartin/3946898 to your computer and use it in GitHub Desktop.
FacesContext and ADF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FacesContext | |
FacesContext facesCtx = FacesContext.getCurrentInstance(); | |
// find UIComponent | |
UIComponent input = facesCtx.getViewRoot().findComponent("f1"); | |
// change the locale | |
facesCtx.getViewRoot().setLocale( Locale.ENGLISH); | |
// el expression | |
Application app = facesCtx.getApplication(); | |
ExpressionFactory elFactory = app.getExpressionFactory(); | |
ELContext elContext = facesCtx.getELContext(); | |
ValueExpression valueExp = elFactory.createValueExpression(elContext, | |
"#{xxxx}", | |
Object.class); | |
Object result = valueExp.getValue(elContext); | |
// add a message | |
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN, | |
"header", | |
"detail"); | |
facesCtx.addMessage(input.getClientId(facesCtx), msg); | |
// ExternalContext | |
ExternalContext ectx = facesCtx.getExternalContext(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment