2016-11-10 5 views
1

タイトルとして、接頭辞が「javaee:」で、「javaee:」ではないタグとはどのような違いがありますか。 、およびタグの接頭辞で「JavaEEのは:」:「JavaEEの」接頭辞「javaee:」とweb.xmlの「javaee:」とではないタグの違いは何ですか?

は、私たちはせずに、タグを使用して構成を設定する必要が見つける:

<welcome-file-list> 
    <welcome-file>default.jsp</welcome-file> 
    <welcome-file>default.html</welcome-file> 
</welcome-file-list> 

の働き例えば

動作しません。

しかし

<javaee:welcome-file-list> 
    <javaee:welcome-file>default.jsp</javaee:welcome-file> 
    <javaee:welcome-file>default.html</javaee:welcome-file> 
</javaee:welcome-file-list> 

動作しません。

私はTomcat 8.5.6をサーバーとして使用しています。 XML名前空間は以下をお読み

<web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xml="http://www.w3.org/XML/1998/namespace" 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>SQUEEN WECHAT</display-name> 

    <welcome-file-list> 
     <welcome-file>default.jsp</welcome-file> 
     <welcome-file>default.html</welcome-file> 
    </welcome-file-list> 

    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value> 
      WEB-INF/config/spring/applicationContext.xml 
     </param-value> 
    </context-param> 

    <context-param> 
     <param-name>log4jConfigLocation</param-name> 
     <param-value>WEB-INF/config/log4j.properties</param-value> 
    </context-param> 

    <listener> 
     <listener-class> 
      org.springframework.web.util.Log4jConfigListener 
     </listener-class> 
    </listener> 

    <listener> 
     <listener-class> 
      org.springframework.web.context.ContextLoaderListener 
     </listener-class> 
    </listener> 
</web-app> 
+0

あなたの完全なweb.xmlを、特に開始タグの宣言を示し、私は説明します.. –

答えて

1

は、以下の私のweb.xmlです。これはxmlの基本です。

enter image description here

次のように宣言が似ているのであれば、あなたのweb.xmlのに:

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

名前空間なしで次のように記述することができます。

<welcome-file-list> 
    <welcome-file>default.jsp</welcome-file> 
    <welcome-file>default.html</welcome-file> 
</welcome-file-list> 

あなたのweb.xmlは、カスタム名前空間宣言

注:のxmlns:JavaEEの):持っていることを次のようにのように見える場合

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

を次のように記述する必要があります以下のような名前空間と同じ:

<javaee:welcome-file-list> 
    <javaee:welcome-file>default.jsp</javaee:welcome-file> 
    <javaee:welcome-file>default.html</javaee:welcome-file> 
</javaee:welcome-file-list> 

これはXMLの仕組みです。他に何もない。

関連する問題