HTTP State 404 - / applicationWEB / the resource is not available

0

I'm following a tutorial to create a dynamic web project with eclipse, when running the application on the server I get a message "HTTP Status 404 - / aplicacionWEB /"

these are my current files index.xhtml

<!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:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/iu"
>

<h:head>
<title>Ejemplo Primefaces + JSF</title>
</h:head>
<h:body>
<h1>Inicio de aplicacion</h1>
<h:form>
<p:panel styleClass="session" header="iniciar">
<h:panelGrid columns="3">

  <h:outputLabel value="Usuario"/>
    <p:inputText id="user" required="true"
      requiredMessage="campo requerido">
    </p:inputText>
  <p:message for="user" />

  <h:outputLabel value="Password" />
    <p:inputText id="password" required="true"
       requiredMessage="campo requerido">
    </p:inputText>
  <p:message for="password" />

  </h:panelGrid>
  <h:comandButton value="Enviar" action="#" />
 </p:panel>
</h:form>
</h:body>

</html>

my web.xml file

  <?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"
     xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
     http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID"       version="3.0">
  <display-name>primefaces</display-name>
  <!-- cambiar a produccion cuanod este listo pra desplehar -->
  <context-param>
   <param-name>javax.faces.PROJECT_STAGE</param-name>
   <param-value>Development</param-value>
  </context-param>

<!-- pagina de bienvenida -->  
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>

<!-- JSF mapeo -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<!-- mapea estos archivos con JSF  -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>

What do you think is my mistake? I followed the example to the letter but does not display the form as in the example

    
asked by Gerardo Bautista 15.05.2017 в 09:58
source

1 answer

1

Normally the jsf applications remain with the signature of url link being the file.xhtml the name of your xhtml The above is due to this rule in the web.xml file

<servlet-mapping>
     <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>'
    
answered by 15.05.2017 / 17:10
source