gpt4 book ai didi

java - 创建servlet时为"Web application version is unsupported"

转载 作者:行者123 更新时间:2023-11-30 07:35:34 25 4
gpt4 key购买 nike

我正在关注教程http://javanetbeans.net78.net/kb/60/web/tutorial-webapps.html

当我到达“使用 servlet 创建前端 Controller ”部分时,我收到来自 Netbeans 的错误,提示“Web 应用程序版本不受支持”

使用netbeans 6.8

谁能解释一下为什么我会收到此提示?

这是我的 web-xml 文件的内容

<?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 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="/Midnight" version="2.5">
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>

最佳答案

查看<web-app>中的“版本”属性设置了什么值web.xml 文件的元素。以下是 2.5 版 Web 应用程序的示例:

<?xml version="1.0" encoding="ISO-8859-1"?>
<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">
<!-- The rest of your web.xml content -->
</web-app>

也许您的设置为容器不支持的其他内容。

关于java - 创建servlet时为"Web application version is unsupported",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4369911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com