欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Spring boot 添加jsp支持配置詳解

 更新時(shí)間:2017年06月09日 14:27:40   作者:Smile___you  
本篇文章主要介紹了Spring boot 添加jsp支持配置詳解,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

spring boot添加對(duì)jsp的支持,以下是pom.xml文件的配置

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
  <modelVersion>4.0.0</modelVersion> 
 
  <groupId>spring_web_boot</groupId> 
  <artifactId>spring_web_boot_base</artifactId> 
  <packaging>war</packaging> 
 
  <version>0.0.1-SNAPSHOT</version> 
  <name>spring_web_boot_base Maven Webapp</name> 
  <url>http://maven.apache.org</url> 
 
 
  <!-- 繼承父包,此包會(huì)添加依賴,spring用到的核心包--> 
  <parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.4.0.RELEASE</version> 
    <relativePath></relativePath> 
  </parent> 
 
  <!-- spring-boot的web啟動(dòng)的jar包 --> 
  <dependencies> 
    <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 
 
    <!--jpa的jar包 ,操作數(shù)據(jù)庫(kù)的,類似hibernate --> 
    <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-jpa</artifactId> 
    </dependency> 
 
    <!--mysql驅(qū)動(dòng) --> 
    <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
    </dependency> 
 
    <!--配置servlet--> 
    <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>javax.servlet-api</artifactId> 
    </dependency> 
 
    <!--配置jsp jstl的支持--> 
    <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>jstl</artifactId> 
    </dependency> 
 
    <!--添加對(duì)tomcat的支持--> 
    <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-tomcat</artifactId> 
      <scope>provided</scope> 
    </dependency> 
 
    <!--對(duì)jsp的支持--> 
    <dependency> 
      <groupId>org.apache.tomcat.embed</groupId> 
      <artifactId>tomcat-embed-jasper</artifactId> 
    </dependency> 
  </dependencies> 
 
  <!-- Package as an executable JAR --> 
  <build> 
    <plugins> 
      <plugin> 
        <groupId>org.springframework.boot</groupId> 
        <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
    </plugins> 
  </build> 
 
  <!-- Allow access to Spring milestones and snapshots --> 
  <!-- (you don't need this if you are using anything after 0.5.0.RELEASE) --> 
  <repositories> 
    <repository> 
      <id>spring-snapshots</id> 
      <url>http://repo.spring.io/snapshot</url> 
      <snapshots> 
        <enabled>true</enabled> 
      </snapshots> 
    </repository> 
    <repository> 
      <id>spring-milestones</id> 
      <url>http://repo.spring.io/milestone</url> 
      <snapshots> 
        <enabled>true</enabled> 
      </snapshots> 
    </repository> 
  </repositories> 
  <pluginRepositories> 
    <pluginRepository> 
      <id>spring-snapshots</id> 
      <url>http://repo.spring.io/snapshot</url> 
    </pluginRepository> 
    <pluginRepository> 
      <id>spring-milestones</id> 
      <url>http://repo.spring.io/milestone</url> 
    </pluginRepository> 
  </pluginRepositories> 
</project> 

針對(duì)如上的配置分為2中情況

1.當(dāng)parent標(biāo)簽中引入的是1.4.0版本的話,那么applicaion.properties中配置jsp前綴和后綴的時(shí)候應(yīng)該配置如下,一定要帶上mvc

spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp

2.當(dāng)parent標(biāo)簽中引入的是1.1.3版本的話,那么applicaion.properties中配置jsp前綴和后綴的時(shí)候應(yīng)該配置如下,一定不要帶上mvc

spring.view.prefix=/WEB-INF/jsp/
spring.view.suffix=.jsp

注意事項(xiàng):

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

針對(duì)如上在pom.xml中配置一定不要加上作用于為provided

最后附帶上maven settings.xml中添加阿里云的maven路徑,可以提高下載速度

<mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>*</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
  </mirror> 

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 詳解Java中日期工具類的操作

    詳解Java中日期工具類的操作

    這篇文章主要為大家詳細(xì)介紹了Java中日期工具類的常見操作,如:字符串和Date互轉(zhuǎn)、字符串和LocalDate互轉(zhuǎn)等,感興趣的小伙伴可以學(xué)習(xí)一下
    2022-11-11
  • 詳解SpringBoot多跨域請(qǐng)求的支持(JSONP)

    詳解SpringBoot多跨域請(qǐng)求的支持(JSONP)

    跨域是很多項(xiàng)目需要遇到的文章,本篇文章主要介紹了詳解SpringBoot多跨域請(qǐng)求的支持(JSONP),具有一定的參考價(jià)值,有興趣的可以了解一下
    2017-04-04
  • Java桶排序之基數(shù)排序詳解

    Java桶排序之基數(shù)排序詳解

    這篇文章主要為大家介紹了Java桶排序之基數(shù)排序,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助
    2021-12-12
  • SpringBoot加載應(yīng)用事件監(jiān)聽器代碼實(shí)例

    SpringBoot加載應(yīng)用事件監(jiān)聽器代碼實(shí)例

    這篇文章主要介紹了SpringBoot加載應(yīng)用事件監(jiān)聽器代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-06-06
  • 一文詳解如何配置MyBatis實(shí)現(xiàn)打印可執(zhí)行的SQL語句

    一文詳解如何配置MyBatis實(shí)現(xiàn)打印可執(zhí)行的SQL語句

    在MyBatis中,動(dòng)態(tài)SQL是一個(gè)強(qiáng)大的特性,允許我們?cè)赬ML映射文件或注解中編寫條件語句,根據(jù)運(yùn)行時(shí)的參數(shù)來決定SQL的具體執(zhí)行內(nèi)容,這篇文章主要給大家介紹了關(guān)于如何配置MyBatis實(shí)現(xiàn)打印可執(zhí)行的SQL語句的相關(guān)資料,需要的朋友可以參考下
    2024-08-08
  • 詳解Java的四種引用方式及其區(qū)別

    詳解Java的四種引用方式及其區(qū)別

    這篇文章主要介紹了Java的四種引用方式 ,主要主要包括強(qiáng)引用,軟引用,弱引用,虛引用,稍微整理精簡(jiǎn)一下做下分享,具有一定的參考價(jià)值,需要的朋友可以參考下
    2018-12-12
  • Java dom4j創(chuàng)建解析xml文檔過程解析

    Java dom4j創(chuàng)建解析xml文檔過程解析

    這篇文章主要介紹了Java dom4j創(chuàng)建解析xml文檔過程解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-07-07
  • Java將科學(xué)計(jì)數(shù)法數(shù)據(jù)轉(zhuǎn)為字符串的實(shí)例

    Java將科學(xué)計(jì)數(shù)法數(shù)據(jù)轉(zhuǎn)為字符串的實(shí)例

    下面小編就為大家?guī)硪黄狫ava將科學(xué)計(jì)數(shù)法數(shù)據(jù)轉(zhuǎn)為字符串的實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2016-12-12
  • Spring Boot如何讀取自定義外部屬性詳解

    Spring Boot如何讀取自定義外部屬性詳解

    這篇文章主要給大家介紹了關(guān)于Spring Boot如何讀取自定義外部屬性的相關(guān)資料,這個(gè)功能實(shí)現(xiàn)介紹的很詳細(xì),需要的朋友可以參考下
    2021-05-05
  • 一篇文章帶你使用SpringBoot基于WebSocket的在線群聊實(shí)現(xiàn)

    一篇文章帶你使用SpringBoot基于WebSocket的在線群聊實(shí)現(xiàn)

    這篇文章主要介紹了一篇文章帶你使用SpringBoot基于WebSocket的在線群聊實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-10-10

最新評(píng)論