前言
这是在使用Servlet时可能会遇到的问题
build-impl.xml:1056: 尚未部署该模块
估计是配置文件web.xml检验失败(文件内容有误)
以下推荐一种方法,能够通过绝对路径访问到Servlet中具体每个方法:
绝对路径的表示:
<form action="${pageContext.request.contextPath}/InfoToCartFromSel.bo " method="post">
该代码段会调用对应bo后缀的Servlet中的方法。
但前提是你要先修改配置文件
在文件中写入这些代码
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<servlet>
<servlet-name>CartServlet</servlet-name>
<servlet-class>com.controller.CartServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CartServlet</servlet-name>
<url-pattern>*.bo</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
完事了之后记得检验,右键空白处后
检验成功之后就能正常使用了
小总结
遇到类似“ build-impl.xml:1056: 尚未部署该模块”问题,一般就是配置文件web.xml没有定义对应的Servlet使用的方法,或者web.xml文件检验错了,里面有不该有的东西。
🤭