jsf - Thorntail 2.3 中的 FacesMessage FacesContext 在哪里?
问题描述
我正在开发测试任务,堆栈:thorntail 2.3.0.Final,PrimeFaces 6.2。
有例子:
public void onRowEdit(RowEditEvent event) {
FacesMessage msg = new FacesMessage("Car Edited", ((Car) event.getObject()).getId());
FacesContext.getCurrentInstance().addMessage(null, msg);
}
但是我无法导入FacesMessage
,并且FacesContext
我的 IDE 在所有依赖项中都找不到它们
我的 pom.xml 带 bom 的一些刺尾:
…
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>cdi</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jpa</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jsf</artifactId>
</dependency>
…
发生什么了?它是 jsf 2.3,对这个包有一些新的方法还是别的什么?
我读过关于 jsf 2.3 的文章,它有一些新特性和一些弃用。
还有在哪里@ViewScoped
?现在我们应该在 CDI 中使用什么?
包在哪里import javax.faces.*
?
我很困惑……</p>
解决方案
看起来像https://github.com/thorntail/thorntail/blob/master/fractions/javaee/jsf/pom.xml中的一个错误没有将 JSF API 添加为您的应用程序可用的依赖项。
一个简单的解决方法是在您的项目中将 JSF API 添加为“提供”,因为在运行时它们将被很好地使用。
推荐阅读
- autohotkey - 自动翻译
- swift - Swift 5 存储和传递 KeyPaths
- vb.net - Linq 异常:对象引用未设置为对象的实例
- python - Tensorflow 2.1 - make_csv_dataset - ValueError: Received a feature column from TensorFlow v1, but this is a TensorFlow v2 Estimator
- php - WooCommerce:仅针对特定用户角色显示我的帐户链接
- rest - 如何为 Spring RestDocs 即 MockMvc 的嵌套订单对象指定 FieldDescriptors
- java - 如何在 log4j2 中增量重新配置?
- laravel - laravel artisan 命令的混乱
- java - 如何点击 reCaptcha 复选框
- javascript - 禁用点击并重置它(Javascript Vanilla)