java - what is the difference between the tag with prefix "javaee:" and not with "javaee:" in web.xml? -


as title, difference between tag prefix "javaee:" , not "javaee:".

i find need set configuration using tag without "javaee:", , tag prefix "javaee:" not work

for example:

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

works

but

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

does not work.

i using tomcat 8.5.6 server.

below web.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> 

read below xml namespace. basics of xml.

enter image description here

so in web.xml if declaration follows:

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

you can write following without namespace.

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

if web.xml looks follows has custom namespace declaration

(note: 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"> 

you have write same namespace follows:

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

it's way how xml works. nothing else.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -