FacesContext.getCurrentInstance().getExternalContext().getFlash()
I am trying to use above code seems like getFlash()
does not exist in JSF2 implementation of Myfaces. How how can I access it.
Above line gives me this error
The method getFlash() is undefined for the type Object
Here are my imports no issues with them
import javax.faces.context.FacesContext;
import javax.faces.context.Flash;
This compilation error suggests that you're actually building your project against JSF 1.2 instead of JSF 2.0. The java-ee-5 tag on your question only confirms this more as this is usually tied to JSF 1.2.
JSF 2.0 is however supported on a Java EE 5 environment. Doublecheck if you have the proper JSF 2.0 JAR files. Extract if necessary the API and impl JAR files and read the /META-INF/MANIFEST.MF
file. Doublecheck if your faces-config.xml
file is declared conform JSF 2.0. Doublecheck if your IDE's project is configured with a JSF 2.0 facet and is using the JSF 2.0 libs in build path. Doublecheck if your target container doesn't ship with builtin JSF 1.2 libraries or that this is at least turned off.