我的最小项目编译和运行良好。然而,我有很多编辑工作要做,并在xhtml页面上做新的开发工作。我注意到EclipseContentAssist在支持bean组件或像primefaces这样的JSF组件上都不起作用。
有什么我没想到的吗?
我正在尝试使用Eclipse IDE for Enterprise Java and Web Developers(包括孵化组件)中的Jakarta Server Faces 4.0.0将遗留的Dynamic Web Module Maven项目从3.0迁移到Dynamic Web Module 5.0版本:2023-06(4.28.0)。
为了测试,我已经创建了项目(文件->新建->动态Web项目->)目标运行时- apache-tomcat-10.0在TomEE Webprofile 9.1.0动态Web模块版本- 5.0安装JRE - OpenJDK 20.0.1 Jakarta EE 10
我遇到的第一个问题是Eclipse Content Assist在编辑xhtml文件时不工作。
Maven依赖项包括。
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>12.0.0</version>
<classifier>jakarta</classifier>
</dependency>
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>4.2</version>
</dependency>
字符串
设置项目方面以添加Java Server Faces没有帮助。JSF的默认最大版本是2.3。尝试选择(属性->项目方面->JavaServer Faces)。出现预期的“需要进一步配置”。我选择New User Library并浏览到myfaces-impl-4.0.1 & myfaces-api-4.0.1。Eclipse对话框显示“所需的类javax.faces.FactoryFinder在所选库中不存在”
我知道我可以手动编辑/Hello-2/. settings/org. eclipse. wst. common. project. facet. core. xml文件并添加JSFFacet
<installed facet="jst.jsf" version="4.0"/>
型
这没有帮助,因为Eclipse只是说它找不到jst.jsf.的实现。x1c 0d1x的数据
我在这里找到了一些指导BalusC Code
谢谢你的好意
3条答案
按热度按时间toiithl61#
将Eclipse设置文件org.eclipse.wst.commons.project.facet.core.xml中的facet=“jst.jsf”版本从“4.0”更改为“2.3”,允许内容辅助为xhtml页面上的大多数库组件工作。但是,对支持bean值的引用(如
字符串
不会自动填充。我猜Eclipse只是没有赶上Jakarata的改名?现在看来应该是了。我可能完全错了。
org.eclipse.wst.commons.project.facet.core.xml内容:
的数据
xmq68pz92#
最近,我自己的组件和Omnifaces的组件都遇到了同样的问题。
然而,代码完成对PrimeFaces和JSF标准组件有效。
我有一个Maven WAR项目,它使用了PrimeFaces和OmniFaces工件,还使用了我开发的另一个工件,在同一个Eclipse工作区中,它包含组件。
正如你所看到的,它不适用于我自己的组件(也不适用于Omnifaces):x1c 0d1x的数据
为什么它适用于PrimeFaces组件?一个区别是facelet-taglib声明。
所以我就抄了。
的
但是使用旧的声明是不够的…
您必须maven安装库工件并关闭eclipse中的相关项目,以使其与您自己的组件一起工作(Omnifaces仍然无法工作)。
您可以在左下角看到关闭的项目,与第一个屏幕进行比较:
的
这是不能接受的贸易代码完成与易用性和热代码替换,我希望我的工件开放。最终,有一个解决方案。
1.复制WAR/WEB-INF文件夹中的taglib.xml文件(也是Omnifaces)
1.将副本中的声明更改为reference faces-2.0(旧样式java.sun.com ns)
1.编辑你的web.xml并添加旧样式的context-param javax.faces.FACELETS_LIBRARIES(我使用了旧样式和新样式):
的
现在,当lib项目打开时,它正在为我的组件工作:x1c4d 1x的
此外,对于全方位组件:
型
为了信息的完整性,我的web.xml声明是:
字符串
faces-config.xml:
型
和我的org.eclipse.wst.common. project.facet.core.xml:
型
n7taea2i3#
我找到解决办法了。
1.转到项目属性
1.查找“项目方面”(在搜索框中键入“fac”)
1.在右侧面板中,单击复选框“JavaServerFaces”(2.3)
1.在右侧面板中选择JavaServerFaces Selected,然后选择Runtimes
1.选择要部署的服务器
1.应用并关闭
就是这样
的数据