2017-10-04 9 views
1

私はjsf .xhtmlファイルを持っています。 doctypeを使用する場合JSF 2.2 <!doctype html>が動作しません

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

すべて正常に動作します。しかし、私はHTML5サイトを持っていたいと思います。私は

<!doctype html> 

DOCTYPEを追加すると、私はこのエラーが表示されます。

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

いただきまし通報しますか?ここで

は私の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

はDOCTYPE –

+0

てみてください、あなたはあなたの問題を解決しましたか?はいの場合は、答えを受け入れるか、あなたの解決策を投稿して質問を閉じたものとしてマークしてください – Al1

答えて

0

は、あなたのweb.xmlファイルに

<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"> 

を入れましたか?

+0

はい、ここに私のWeb.xmlがあります。これは長いです...私はペーストします.bin ist –

+0

ここに行きます:https://pastebin.com/0Btah6gc –

+0

このファイル(html)にはどのようなエンコーディングがありますか? @mr mcwolfが示唆しているように、DOCTYPEを大文字で使用しようとしましたか? – soulcoder

0

あなたは次のように変更検討してください。

  1. 使用<!DOCTYPE html>代わり<!doctype html>のようなMRのmcwolfのは、あなたがすでにその選択と一致しているが、私はことを確認しない限り、
  2. *.xhtml instead of *.htmlにJSFページの地図提案javax.faces.DEFAULT_SUFFIX.xhtmlに設定し、.xhtml個のファイルを使用しています...さらにreading about why .xhtml
  3. I'm not sur web.xmlの電子が、私は今のweb.xmlヘッダを含む代わりにjava.sun.comのどこでもxmlns.jcp.org名前空間を使用する習慣を持っている:

    <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" > 
    
関連する問題