How to configure spring boot through annotations in order to have something similar to <jsp-config> in web.xml?

 

JSP file not rendering in Spring Boot web application

You will need not one but two dependencies (jasper and jstl) in your pom.xml for this to work.

   <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
</dependencies>

 

You just made my day! This helped me - even though my issue was slightly different - Spring wasn't evenfinding my .jsp files in /src/main/resources/webapp/WEB-INF/pages. Thank you so much! 

http://stackoverflow.com/questions/20602010/jsp-file-not-rendering-in-spring-boot-web-application

 

How to configure spring boot through annotations in order to have something similar to <jsp-config> in web.xml?

How to configure spring boot through annotations in order to have something similar to in web.xml?

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <url-pattern>*.jspf</url-pattern>
        <page-encoding>UTF-8</page-encoding>
        <scripting-invalid>false</scripting-invalid>
        <include-prelude>/WEB-INF/jsp/base.jspf</include-prelude>
        <trim-directive-whitespaces>true</trim-directive-whitespaces>
        <default-content-type>text/html</default-content-type>
    </jsp-property-group>
</jsp-config>

 

I think Dave gave a pretty straight forward answer - that is - there is no Java API defined by the Servlet spec for configuring JSPs and if you must use it with Spring Boot you just need to use web.xml which Spring Boot perfectly supports. This sounds pretty clear to me.

Cheers.

 

http://stackoverflow.com/questions/24293901/how-to-configure-spring-boot-through-annotations-in-order-to-have-something-simi

 

时间: 2024-10-29 06:52:08

How to configure spring boot through annotations in order to have something similar to <jsp-config> in web.xml?的相关文章

Spring Boot下配置MyBatis多数据源

Spring Boot最大的特点是简化开发,因此使用Java Config实现去xml配置,本文将使用这种方式完成对阿里云ADS和RDS两个产品的多数据源配置.同时,会用到阿里巴巴的开源数据源Druid. 依赖 因为ADS和RDS都兼容mysql的JDBC实现,因此工程只需要依赖mysql的driver. Spring Boot易用性的特点是通过Starter实现的,我们只需依赖mybatis的spring-boot-starter即可. Druid是数据源. <dependency> <

Manage Spring Boot Logs with Elasticsearch, Logstash and Kibana

下载地址:https://www.elastic.co/downloads   When time comes to deploy a new project, one often overlooked aspect is log management. ELK stack (Elasticsearch, Logstash, Kibana) is, among other things, a powerful and freely available log management solutio

Spring Boot MyBatis 连接数据库

最近比较忙,没来得及抽时间把MyBatis的集成发出来,其实mybatis官网在2015年11月底就已经发布了对SpringBoot集成的Release版本,Github上有代码:https://github.com/mybatis/mybatis-spring-boot 前面对JPA和JDBC连接数据库做了说明,本文也是参考官方的代码做个总结. 先说个题外话,SpringBoot默认使用 org.apache.tomcat.jdbc.pool.DataSource 现在有个叫 HikariCP

Spring Boot使用Druid和监控配置

完美与Spring Boot集成. 1.编写Spring Boot Druid配置类 DruidDataSourceProperties.java package org.paascloud.ops.config; import org.springframework.boot.context.properties.ConfigurationProperties; import java.util.Properties; /** * Created by meyer on 2017/1/15.

使用 Spring Boot 快速构建 Spring 框架应用,PropertyPlaceholderConfigurer

Spring 框架对于很多 Java 开发人员来说都不陌生.自从 2002 年发布以来,Spring 框架已经成为企业应用开发领域非常流行的基础框架.有大量的企业应用基于 Spring 框架来开发.Spring 框架包含几十个不同的子项目,涵盖应用开发的不同方面.如此多的子项目和组件,一方面方便了开发人员的使用,另外一个方面也带来了使用方面的问题.每个子项目都有一定的学习曲线.开发人员需要了解这些子项目和组件的具体细节,才能知道如何把这些子项目整合起来形成一个完整的解决方案.在如何使用这些组件上

使用JWT保护你的Spring Boot应用 - Spring Security实战

作者 freewolf 原创文章转载请标明出处 关键词 Spring Boot.OAuth 2.0.JWT.Spring Security.SSO.UAA 写在前面 最近安静下来,重新学习一些东西,最近一年几乎没写过代码.整天疲于奔命的日子终于结束了.坐下来,弄杯咖啡,思考一些问题,挺好.这几天有人问我Spring Boot结合Spring Security实现OAuth认证的问题,写了个Demo,顺便分享下.Spring 2之后就没再用过Java,主要是xml太麻烦,就投入了Node.js的怀

《Spring Boot官方指南》翻译邀请

学技术并发网始终建议同学们阅读原版官方文档,所以并发网每月都会组织大家翻译各种官方技术文档.9月份并发网组织大家翻译<Spring Boot官方指南>,欢迎有兴趣的同学参与. 如何领取  通过评论领取想要翻译的文章,每次领取一章,如Spring Boot Documentation,翻译完后再领取其他章节.领取完成之后,建议在一个星期内翻译完成,如果不能完成翻译,也欢迎你邀请其他同学和你一起完成翻译. 如何提交? 翻译完成之后请登录到并发网提交成待审核状态,会有专门的编辑校对后进行发布.校对完

40. Testing Prev Part IV. Spring Boot features

40. Testing Spring Boot provides a number of utilities and annotations to help when testing your application. Test support is provided by two modules; spring-boot-test contains core items, and spring-boot-test-autoconfigure supports auto-configuratio

Spring Boot ConfigurationProperties validate

使用@Query可以在自定义的查询方法上使用@Query来指定该方法要执行的查询语句,比如:@Query("select o from UserModel o where o.uuid=?1")public List<UserModel> findByUuidOrAge(int uuid);注意:1:方法的参数个数必须和@Query里面需要的参数个数一致2:如果是like,后面的参数需要前面或者后面加"%",比如下面都对:@Query("sel