Introduction
There is a warning message appear upon running Java web application. It is when the execution of a JSF file of the Java web application after the deployment of it in the Wildfly application server. The following is the appearance of the JSF file displaying the warning message :
The above image is the result of the following JSF file with the name of ‘db-connection-test.xhtml’ :
<?xml version="1.0" encoding="UTF-8"?> <!-- Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/XHtml.xhtml to edit this template --> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <h:head> <title>Database Connection</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> </h:head> <body> <p:outputPanel> <p:outputLabel id="connectionStatus" value="#{dbConnectionTestView.status}"></p:outputLabel> </p:outputPanel> <p:commandButton type="button" value="Alert" onclick="alert('Prime')" actionListener="#{dbConnectionTestView.submit()}"/> </body> </html>
Actually, there is a specific warning message exist in the JSF file form above.
The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>
How to Solve Warning Message
Using the above information, especially the warning message exist, just do the suggestion. It is by enclosing the component in the JSF file within <h:form>. The problem is which component is the one for further enclosing. Actually, it is quite clear that the elements are those which is normally part of a regular form. In this context, it is an outputLabel where it will display the status of the database connection. Moreover, it include the commandButton element. So, the revision for the form exist as follows :
<?xml version="1.0" encoding="UTF-8"?> <!-- Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/XHtml.xhtml to edit this template --> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <h:head> <title>Database Connection</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> </h:head> <body> <h:form> <p:outputPanel> <p:outputLabel id="connectionStatus" value="#{dbConnectionTestView.status}"></p:outputLabel> </p:outputPanel> <p:commandButton type="button" value="Alert" onclick="alert('Prime')" actionListener="#{dbConnectionTestView.submit()}"/> </h:form> </body> </html>
If there are no other error appear, the following image will display the JSF file page :