非 WAR JSP spring-boot 示例 [英] Non WAR JSP spring-boot example
问题描述
我一直在检查大部分 spring-boot 提供的 JSP 示例,因为视图技术被打包为 WAR 工件.
I've been checking out most of all spring-boot provided examples for JSP as view technologie are being packaged as WAR artifacts.
如果可能的话,提供一个 jar 示例会很好吗?
Would be nice to provide a jar example for this if possible?
我知道 JSP 需要一个 Servlet Engine/Servlet Container,而不是例如 Freemarker .. 用于渲染 .. 但是作为 Jetty 或 Tomcat Servlet Containers 这个选项可行吗?
I know that JSP requires a Servlet Engine/Servlet Container as opposed as e.g Freemarker .. for rendering .. but being Jetty or Tomcat Servlet Containers is this option viable and possible ?
到目前为止尝试这种设置并没有太大成功,我最后一次尝试是创建一个
Trying that setup so far with not much success, my last try was to create a
META-INF/resources 文件夹放置所有这些 jsp 资源,但它们仍然对 ViewResolver 不可见
META-INF/resources folder to put all those jsp resources but they are still not visible to the ViewResolver
@Bean
public ViewResolver jspViewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/META-INF/resources/jsp/");
viewResolver.setSuffix(".jsp");
viewResolver.setOrder(2);
return viewResolver;
}
最后..正在尝试像这里这样的设置:
At the end.. was trying some setup like here:
http://alexismp.wordpress.com/2010/04/28/web-inflib-jarmeta-infresources/
谢谢
推荐答案
AFAIK 这是不可能的(由于容器施加的限制):http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-jsp-限制
AFAIK it's not possible (owing to limitations imposed by the containers): http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-jsp-limitations
这篇关于非 WAR JSP spring-boot 示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!