http://localhost:8080/fm-web/test.ftl显示404

来源:4-1 Freemarker与Servlet整合

大圣归来²

2020-08-12 21:23:03

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

  <display-name>fm-web</display-name>

  <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>

  <servlet>

  <servlet-name>freemarker</servlet-name>

  <servlet-class>freemarker.ext.servlet.FreemarkerServlet</servlet-class>

  <init-param>

  <param-name>TemplatePath</param-name>

  <param-value>/WEb-INF/ftl</param-value>

  </init-param>

  </servlet>

  

  <servlet-mapping>

  <servlet-name>freemarker</servlet-name>

  <url-pattern>*.ftl</url-pattern>

  </servlet-mapping>

</web-app>



http://img.mukewang.com/climg/5f33ed3509e04f7c09640725.jpg


写回答

1回答

好帮手慕小尤

2020-08-13

同学你好,建议将web.xml下配置的WEb-INF修改为WEB-INF。如下所示:

http://img.mukewang.com/climg/5f349fee0917f9fa06640248.jpg

如果我的回答解决了你的疑惑,请采纳!祝学习愉快!

0

0 学习 · 9666 问题

查看课程