Consider two web.xml files: 1.



<web-app xmlns:xsi="http://ift.tt/ra1lAU"
xmlns="http://ift.tt/nSRXKP"
xsi:schemaLocation="http://ift.tt/nSRXKP http://ift.tt/1eWqHMP"
version="3.0">

<display-name>app</display-name>
<servlet>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<servlet-name>dispatcher</servlet-name>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>


2.



<web-app>

<display-name>app</display-name>
<servlet>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<servlet-name>dispatcher</servlet-name>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>


The difference between them is that the web-app tag contains the attributes in the first one and in the second one doesn't. The issue is if we apply the second web.xml we won't be able to use expressions like



${attrName}


in our jsp-pages. They won't be replaced with the corresponding values, added to a model in a Controller in the case of Spring MVC.


I thought, the only purpose we specify the schemaLocation attribute is to validate our xml-file (to get XSD-schema). How do the attributes actually work?


No comments:

Post a Comment