2017-10-04 2 views
1

J'ai un fichier jsf .xhtml. Si j'utilise le doctypeJSF 2.2 <! Doctype html> ne fonctionne pas

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

tout fonctionne bien. Mais j'aimerais avoir un site HTML5. Quand j'ajoute le

<!doctype html> 

doctype Je reçois cette erreur:

error on line 1 at column 2: StartTag: invalid element name 

Quel est le problème?

Voici mon web.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="3.0" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 

    <display-name>ZaplianceLogAnalyser</display-name> 

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

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

    <context-param> 
     <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description> 
     <param-name>javax.faces.STATE_SAVING_METHOD</param-name> 
     <param-value>client</param-value> 
    </context-param> 

    <context-param> 
     <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> 
     <param-value>resources.application</param-value> 
    </context-param> 

    <listener> 
     <listener-class>com.sun.faces.config.ConfigureListener</listener-class> 
    </listener> 

    <context-param> 
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
     <param-value>.xhtml</param-value> 
    </context-param> 

</web-app> 
+2

essayer avec DOCTYPE –

+0

Avez-vous résolu votre problème? Si oui, veuillez accepter une réponse ou poster votre solution pour marquer la question comme étant fermée – Al1

Répondre

0

Avez-vous mis

<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 

dans votre fichier web.xml?

+0

Oui, voici mon Web.xml. Ok c'est à long ... Je vais coller.bin ist –

+0

Voilà: https://pastebin.com/0Btah6gc –

+0

Quel type d'encodage avez-vous sur ce fichier (html)? Avez-vous essayé d'utiliser DOCTYPE en majuscule comme suggéré par @mr mcwolf? – soulcoder

0

Vous pouvez envisager les modifications suivantes:

  1. Utilisation <!DOCTYPE html> au lieu de <!doctype html> comme mr mcwolf non contractuel
  2. mapper vos pages JSF à *.xhtml instead of *.html sauf si vous êtes déjà en accord avec ce choix, mais je vois que vous définissez votre javax.faces.DEFAULT_SUFFIX à .xhtml et vous utilisez .xhtml fichiers ... Autres reading about why .xhtml
  3. Je ne suis pas sur e pour web.xml mais j'ai maintenant l'habitude d'utiliser l'espace de noms xmlns.jcp.org partout au lieu de l'en-tête java.sun.com y compris web.xml:

    <web-app xmlns="http://xmlns.jcp.org/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" >