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

來源:互聯網
上載者:User

標籤:ret   rect   link   over   lin   app   use   tom   efault   

 

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

 

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.