I recently migrated project from javax to Jakarta EE v10, jdk 11 to 17, and Tomcat 10.1, primefaces v13
In earlier project, when I opened .xhtml files, and pressed control and clicked on any java class or method, it used to navigate to that specific method/file.
After migration, this has stopped working and so is code assist in xhtml files for java classes/methods.
My classes are defined as:
import jakarta.inject.Named;
import org.springframework.web.context.annotation.SessionScope;
@Named(LoginWorkBean.NAME)
@SessionScope
public class LoginWorkBean {
private static final long serialVersionUID = 2383439018xL;
public static final String NAME = "loginWorkBean";
public String userName; //and getters and setters
}
xhtml files:
Here, earlier, If I pressed ctrl and click on loginWorkBean it will take me to above class. Now, after migration, this has stopped working, it throws no error/exceptions.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"hxxp://wxw.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="hxxp://wxw.w3.org/1999/xhtml"
xmlns:ui="hxxp://java.sun.com/jsf/facelets"
xmlns:h="hxxp://java.sun.com/jsf/html"
xmlns:o="hxxp://omnifaces.org/ui" xmlns:p="hxxp://primefaces.org/ui"
xmlns:f="hxxp://java.sun.com/jsf/core">
<ui:composition>
<h:outputText
value="#{loginWorkBean.userName}"
styleClass="bold" escape="false" />
</ui:composition>
</html>
faces-config.xhtml:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="hxxp://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="hxxp://wxw.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="hxxp://jakarta.ee/xml/ns/jakartaee
hxxp://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd"
version="4.0">
</faces-config>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="hxxp://wxw.w3.org/2001/XMLSchema-instance"
xmlns="hxxp://jakarta.ee/xml/ns/jakartaee"
xmlns:web="hxxp://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="hxxp://jakarta.ee/xml/ns/jakartaee hxxp://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd hxxp://xmlns.jcp.org/xml/ns/javaee hxxp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="5.0">
<context-param>
<param-name>jakarta.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>jakarta.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>saga</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.AUTOMATIC_EXTENSIONLESS_MAPPING</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
Below are my approaches which didn't worked:
- Added JBoss Dependency
- Converted @SessionScope annotation to @SessionScoped and added @ManagedBean
- Added Dependency Spring Tools Suite in Eclipse
- Downloaded latest Eclipse IDE for Enterprise Java and Web Developers
- Downloaded fresh Jakarta project from Jakarta EE starter, and imported it.
- Downloaded MyEclipse and imported my project.
- Changed xhtml tags to below:
xmlns="hxxp://wxw.w3.org/1999/xhtml"
xmlns:f="jakarta.faces.core"
xmlns:jsf="jakarta.faces"
xmlns:h="jakarta.faces.html"
Approaches which worked:
- In NetBeans IDE it worked as expected. I was able to ctrl+click on java classes/methods and navigate to them, the code assist also worked. But I am used to Eclipse and I want to support this for my Jakarta project as well.
- Sometime cmd+. works for auto completion/code suggestion but they are not exact variable names.
Let me know if you need more information. Thank you!