web.xml版本差异的问题

Web.xml文件有2.3、2.4、2.5、3.0版本,其中有一个很重要的配置差异: 在Servlet 2.5 版本中可以这样配置,多个url映射到同一个servlet。具体如下。 <servlet-mapping> <servlet-name>servletName</servlet-name> <url-pattern>/index</url-pattern> <url-pattern>/login</url-pattern> </servlet-mapping> 在2.3或2.4中不能。 Servlet 2.3 <?xml version=“1.0” encoding=“UTF-8”?> <!DOCTYPE web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN” “http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> … </web-app> Servlet 2.4 <?xml version=“1.0” encoding=“UTF-8”?> <web-app xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance" xmlns=“http://java.sun.com/xml/ns/j2ee" xmlns:web=“http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" xsi:schemaLocation=“http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd " version=“2.4”> … </web-app> Servlet 2.5 <?xml version=“1.0” encoding=“UTF-8”?> <web-app xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance" xmlns=“http://java.sun.com/xml/ns/javaee" xmlns:web=“http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation=“http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id=“WebApp_ID” version=“2.5”> Servlet 3.0 <?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">

2014年1月4日 · 1 分钟

How to fix your entire life in 1 day - Bilingual Edition 如何在一天内修复你的人生 - 双语对照版 Author / 作者: Dan Koe Published / 发布日期: December 23, 2025 Source / 来源: https://letters.thedankoe.com/p/how-to-fix-your-entire-life-in-1 [EN] I’m not here to talk down on you. I’ve quit 10 times more goals than I’ve set. I think that should be the case for most people. But the fact that people try to change their lives and utterly fail almost every time holds true. So much so that it’s a meme for the gym to be crowded during January and return back to normal in February. ...

28 分钟