我试图从名为message.properties的prop文件中获取消息,我使用了@ManagedProperty,但是它返回null
facesutil文件
public class FacesUtils {
/**
* the bundle variable of type ResourceBundle
*/
@ManagedProperty("#{message}")
private static ResourceBundle bundle;
public static void errorMessage(String summary, String detail) {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, bundle.getString(summary), bundle.getString(detail)));
}
// getter and setter
}
并且我在面部配置文件中定义消息
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<resource-bundle>
<base-name>com.erabia.platform.erabiaen</base-name>
<var>message</var>
</resource-bundle>
</application>
我使用了primefaces 6.0