What I did
I created a Maven project and added the JSF module, however, even with the downloaded library.
What's happening
When I run my project using Tomcat , the olamundo.xhtml page is blank.
The URL should come as http://localhost:8888/projeto-teste-livro/olamundo.jsf
, but it comes very differently http://localhost:8888/projeto-teste/web/olamundo.xhtml
. It looks like the project is not being identified as a JSF application.
What I'm trying to do
I'm just recreating a little test I did on Eclipse to be able to compare using IntelliJ IDE .
My Environment
Project Folder
ApplicationSettings
AlthoughthereisnosubitemwithinWeb,realizethatitalreadyidentifiesthatIhavetheMojarralibrarydownloadedhereintheproject.
Pom.xml
<?xmlversion="1.0" encoding="UTF-8"?>
<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>groupid-teste</groupId>
<artifactId>artifacit-teste</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
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_3_1.xsd"
version="3.1">
<!-- -->
<display-name>projeto-teste</display-name>
<!-- Indica que o JSF(FacesServlet) está instalado e responderá as requisições -->
<servlet>
<servelet-name>Faces Servlet</servelet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Mapeamento dos sufixos dos arquivos do front end -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<!-- Indica a fase de desenvolvimento do projeto. Com o "development", exceptions terão maior descrição -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- Campos do formulário submitados em branco serão tratados como nulos -->
<context-param>
<param-name>javax.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<!-- Indica que campos de data e hora utilizarão o fuso horário definido no sistema. -->
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<!--
Defini quais arquivos serão exibidos(em ordem de prioridade), caso o endereço
requisitado não especifique um arquivo diretamente
-->
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
<!-- -->
<repositories>
<repository>
<id>jvnet-nexus-releases</id>
<name>jvnet-nexus-releases</name>
<url>http://maven.java.net/content/repositories/releases/</url>
</repository>
</repositories>
<!-- -->
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.10</version>
</dependency>
</dependencies>
<!-- -->
</web-app>
olamundo.xhtml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
<title>Teste Inicial JSF</title>
</h:head>
<h:body>
<h:outputText value="Olá Mundo" />
<p>asdsadsa</p>
</h:body>
</html>