Netbeans IDE 19 - Issue with Integrating JSF 4.0 and Primefaces in a Maven Application on Tomcat 10

trinityamad

trinityamad

Posted on September 28, 2023

Netbeans IDE 19 - Issue with Integrating JSF 4.0 and Primefaces in a Maven Application on Tomcat 10

Dear community,

I am reaching out to you in hopes of obtaining assistance with an issue I am encountering while integrating Jakarta EE 10, JSF 4.0, and Primefaces in a Maven web application on Tomcat 10.1.13.
I am an user of NetBeans and have recently started working on a project that requires this specific configuration.

  • IDE: NetBeans 19
  • Server: Apache Tomcat 10.1.13
  • Jakarta EE Version: 10
  • JSF: 4.0
  • Primefaces: 13.0.0
  • Dependency Management: Maven
  • web.xml, pom.xml and login.xhtml as specified below.

web.xml

<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_6_0.xsd"
version="6.0">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>login.xhtml</welcome-file>
</welcome-file-list>
<content-param>
<param-name>jakarta.faces</param-name>
</content-param>
<context-param>
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
</web-app>

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.sas</groupId>
<artifactId>ProjectName</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>ProjectName-1.0-SNAPSHOT</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jakartaee>10.0.0</jakartaee>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.faces</groupId>
<artifactId>jakarta.faces-api</artifactId>
<version>4.0.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>13.0.0</version>
<classifier>jakarta</classifier>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</build>
</project>

login.xhtml page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="jakarta.faces.html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Login Page</title>
<link href="source/style/stylesheet.css" rel="stylesheet" type="text/css" />
</h:head>
<h:body>
<h:form>
<h1>
Hello world
</h1>
<h:outputText value="Hello"/>
<p:panel header="Login" rendered="true">
<p:inputText id="username" value="#{loginBean.username}" placeholder="Username" rendered="true"/>
<p:password id="password" value="#{loginBean.password}" placeholder="Password" feedback="false" rendered="true"/>
<p:commandButton value="Login" action="#{loginBean.login}" ajax="false" rendered="true"/>
</p:panel>
</h:form>
</h:body>
</html>

I tried to configure the JavaServer Faces in the Project Properties --> Frameworks
but all I got is disabled fields, as it shows in the screenshot:

Image description

The issue I am facing is that when I attempt to load the XHTML page with JSF and Primefaces components, the page only displays the text "Hello world" and no JSF or Primefaces components aren't rendered at all.

Also there are no exceptions showing nor in the browser console or in the Netbeans' logs.

I have carefully reviewed my configuration, including web.xml, pom.xml, and the XHTML code, but I cannot identify the reason for this unexpected behavior.

I have searched for solutions online and followed recommended procedures to properly configure JSF 4.0 and Primefaces with Tomcat 10, but the issue isn't common and there's no solutions here.

I hope you can provide guidance or suggestions on how to resolve this problem and make the integration between Jakarta EE 10, JSF 4.0, and Primefaces in my Maven application on Tomcat 10 work correctly. It will be of great help to me and my project.

Thank you in advance for your attention and help. I look forward to your response and am available to provide further details or information if needed.

Best regards

Marco C.

💖 💪 🙅 🚩
trinityamad
trinityamad

Posted on September 28, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related