Java 包括用户上传的html文件

Java 包括用户上传的html文件,java,spring-boot,thymeleaf,wildfly-9,Java,Spring Boot,Thymeleaf,Wildfly 9,这就是我想要做的:用户上传一堆html文件作为zip存档。我解压归档文件并在网站上显示html内容 为此,我希望将html内容包含到thymeleaf页面中。到目前为止,我已经尝试过: <div th:include="http://localhost:8181/MySpringApp/uploads/include.html"></div> <div th:include="@{/uploads/include.html}"></div> <

这就是我想要做的:用户上传一堆html文件作为zip存档。我解压归档文件并在网站上显示html内容

为此,我希望将html内容包含到thymeleaf页面中。到目前为止,我已经尝试过:

<div th:include="http://localhost:8181/MySpringApp/uploads/include.html"></div>
<div th:include="@{/uploads/include.html}"></div>
<div th:include="@{~/uploads/include.html}"></div>
我怎样才能让它工作呢?我只看到过包含
模板
文件夹中的静态文件的示例。但那不是我想做的


我使用的是Wildfly 9,在
standalone/data
文件夹中,我创建了
uploads
文件夹。

这样的代码应该可以工作:

<div th:include="@{/uploads/include}"></div>

这可能是许可证问题吗?我只是想知道,因为你说一些外部用户可以上传这些文件,所以你可能没有正确的权限来显示或使用它们


希望有帮助

假设您的
上传
文件夹位于
模板
下,请将HTML插入为:

<div th:insert="~{uploads/include}"></div>

顺便说一句,
th:include
是不推荐的,因为Thymeleaf 3.0

<div th:insert="~{uploads/include}"></div>