定义了一个servlet类,在配置web.xml的时候出错,怎么回事?
<?xmlversion="1.0"encoding="UTF-8"?><servlet><servlet-name>MyServlet</servlet-name><s...
<?xml version="1.0" encoding="UTF-8"?>
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.servlet.MyServlet</servlet-class>
</servlet>
<servlet-mapping>//(在eclipse中这行提示The markup in the document following the root element must be well-formed.)
<servlet-name>MyServlet</servlet-name>
<url-patttern>/MyServlet</url-patttern>
</servlet-mapping> 展开
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.servlet.MyServlet</servlet-class>
</servlet>
<servlet-mapping>//(在eclipse中这行提示The markup in the document following the root element must be well-formed.)
<servlet-name>MyServlet</servlet-name>
<url-patttern>/MyServlet</url-patttern>
</servlet-mapping> 展开
2个回答
展开全部
我给你个我曾经写的例子吧,如果不行,请继续追问
<?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">
<servlet>
<servlet-name>SendMsg</servlet-name>
<servlet-class>my.jsp.Servlet.SendMsg</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SendMsg</servlet-name>
<url-pattern>/SendMsgTest</url-pattern>
</servlet-mapping>
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
<?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">
<servlet>
<servlet-name>SendMsg</servlet-name>
<servlet-class>my.jsp.Servlet.SendMsg</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SendMsg</servlet-name>
<url-pattern>/SendMsgTest</url-pattern>
</servlet-mapping>
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
追问
什么作用?
追答
index.jsp 这个是设置网站默认访问,如果你把index.jsp设置为 你自己的名称,也可以
英文解释就是访问文件的集合
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
就是要放在根下
<web-app>
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.servlet.MyServlet</servlet-class>
</servlet>
<servlet-mapping>//(在eclipse中这行提示The markup in the document following the root element must be well-formed.)
<servlet-name>MyServlet</servlet-name>
<url-patttern>/MyServlet</url-patttern>
</servlet-mapping>
</web-app>
<web-app>
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.servlet.MyServlet</servlet-class>
</servlet>
<servlet-mapping>//(在eclipse中这行提示The markup in the document following the root element must be well-formed.)
<servlet-name>MyServlet</servlet-name>
<url-patttern>/MyServlet</url-patttern>
</servlet-mapping>
</web-app>
追问
每一个servlet都对应一个标签是吗
追答
不是 都放在一个里面
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询