zoukankan      html  css  js  c++  java
  • springboot整合jsp

    1.创建项目时,选择打包方式为war包

     并且勾选

     

    2.webapp包建在main下,格式为 webapp/WEB-INF/jsp

    3.导入相关依赖

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

    </dependency>

    <!-- servlet 依赖 -->
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <scope>provided</scope>
    </dependency>

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

    <!-- tomcat 的支持.-->
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
    </dependency>

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

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    </dependency>


    4.controller层 用controller注解,注意不能使用restcontroller

    5.配置视图解析器(application.properties)

    spring.mvc.view.prefix=/WEB-INF/jsp/
    spring.mvc.view.suffix=.jsp
  • 相关阅读:
    LightOJ 1030 Discovering Gold(期望)
    CodeForces 567B Berland National Library
    HDU
    HDU
    (模拟、进制转换)
    HDU
    HDU
    CodeForces 429 B B. Working out
    CodeForces 546 D. Soldier and Number Game(素数有关)
    2016中国大学生程序设计竞赛
  • 原文地址:https://www.cnblogs.com/de-ming/p/14968468.html
Copyright © 2011-2022 走看看