--Environment - CentOS Linux release 7.8.2003 (Core) - Payara Server 5.194 - Eclipse IDE for Enterprise Java Developers.Version: 2020-03 (4.15.0)
I made a JSF project and wrote XHTML immediately, but ... JSF tags are output as they are
index.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<head>
<title>What to do when JSF tags do not become HTML</title>
</head>
<body>
<h3>What to do when JSF tags do not become HTML</h3>
h:I tried to write a checkbox with selectBooleanCheckbox
<div>
<h:selectBooleanCheckbox id="checkBox" value="false" />
<h:outputLabel for="checkBox" value="Checkbox"/>
</div>
</body>
</html>
Servlet-mapping defines how to specify the URL to access the web application. Introduction to Easy-to-Understand Java EE Web System by Takashi Kawaba
WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>tryJsf</display-name>
...abridgement...
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
If it is the definition of web.xml, it will be displayed as http: //xxxxxx/ {display-name} /faces/index.xhtml
However, this event failed because it was displayed as http: //xxxxxx/ {display-name} /index.xhtml
.
If you use http: //xxxxxx/ {display-name} /index.xhtml
, it will be displayed properly.
Modify web.xml, rebuild and rerun
WEB-INF/web.xml
...abridgement...
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>