I'm studying JSF using the eclipse IDE, but I'm encountering a certain problem when running my application. When I run the application by clicking on top of the project itself, it does not seem to load my created template.
Here's an example:
However,whenIexecutebyclickingdirectlyonthepagethatIwanttodisplay,thetemplateloadscorrectly.
index.xhtml
<ui:compositionxmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
template="/WEB-INF/templates/Layout.xhtml">
<ui:define name="content">Bem-Vindo</ui:define>
</ui:composition>
Layout.xhtml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:head>
<title>Log Horizon</title>
</h:head>
<h:body>
<h1>Teste de Layout</h1>
<hr />
<ui:insert name="content"></ui:insert>
</h:body>
</html>
This happens in every project I create. What could I be doing wrong?