💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
![](https://box.kancloud.cn/36214b3306eb1d79c66396abc8756756_1198x528.png) ![](https://box.kancloud.cn/63a3317878495265eb82c0236196d88f_1228x1084.png) 我们先不跳过 ![](https://box.kancloud.cn/ce21bc063ca8f4b40260f2526492ee5a_1228x1068.png) 一般是跳过骨架的,不跳过骨架一般目录是不全的 ![](https://box.kancloud.cn/16ff7352ba96542653f66603a09e8490_870x406.png) war是web打包 jar是java打包 pom是父项目打包 **处理红色叉号** ![](https://box.kancloud.cn/40f15c348d79974c3d7804223af3fa33_884x290.png) 手动在webapp文件夹下创建一个WEB-INF文件夹,在里面放一个web.xml文件 ~~~ <?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"> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app> ~~~ 这样子红色叉号就解决了 **处理编译版本** 在pom.xml中添加如下代码 ~~~ <build> <!-- 配置了很多插件 --> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build> ~~~ 然后又出现了个小叉号,我们更新下maven ![](https://box.kancloud.cn/1885013597d4533a5d5cb1e8bd243aaa_1170x1548.png) 然后我们创建servlet ![](https://box.kancloud.cn/63631a72171531d3b92a694daf9d578a_1632x810.png) 发现这边在报错,报错的原因是缺少包还有一个原因是web.xml那 他会对web.xml修改,并且对xml头部还有修改 把头部重复的部分给去掉 ![](https://box.kancloud.cn/1633f2aabcd0cd758ba2c554c6cb6447_1576x460.png) 然后我们解决下servlet缺少jar的问题 我们在pom.xml中添加以下代码 ~~~ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.9</version> <scope>test</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jsp-api</artifactId> <version>2.0</version> <scope>provided</scope> </dependency> </dependencies> ~~~ 然后保存,jar包依赖就解决了 然后开始运行 ![](https://box.kancloud.cn/4e904d5a1de65caf2e71d0024588def6_1248x1272.png) 在里面写 ![](https://box.kancloud.cn/0e099a4ae0235b600020e6dca7f809bb_562x468.png) 然后访问`http://localhost:8080/hello/HelloServlet`