java Sparkjava将webapp文件夹设置为静态资源/模板的文件夹
如果我打开这个URL:http://localhost:8080/portal/index.html
浏览器会正确加载我的index.html
(因为它位于portal
文件夹下的根文件夹WebApp)
但是我需要从这个URL加载这个页面:http://localhost:8080/ui/index
。我添加了以下路线:
get("/ui/index", (req, res) -> {
Map<String, Object> model = new HashMap<>();
return new VelocityTemplateEngine().render(
new ModelAndView(model, "portal/index.html")
);
});
但我得到了这个错误:500 Internal Server Error
如果我移动门户/索引。html到资源-索引。html从http://localhost:8080/ui/index
正确加载
如何配置应用程序以加载索引。来自webapp文件夹的html
共 (0) 个答案