解決SpringBoot啟動(dòng)過后不能訪問jsp頁(yè)面的問題(超詳細(xì))
1、首先看SSM(Spring+SpringBoot+Mybatis)的依賴
<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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.easyshop.springboot.web</groupId> <artifactId>easyshop</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.2.RELEASE</version> </parent> <dependencies> <!-- SpringBoot的Web啟動(dòng)器 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--切面--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </dependency> <!--cglib--> <dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>2.1_3</version> </dependency> <!--日志--> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> <!-- MyBatis --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.3.0</version> </dependency> <!-- mybatis和spring整合 1.2.2 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>1.2.2</version> </dependency> <!-- mysql --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.28</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.10</version> </dependency> <!-- JSP相關(guān) --> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <!-- SpringBoot事物管理器 自動(dòng)配置 DataSourceTransactionManager --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <!-- 解析JSP --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> </dependency> </dependencies> <build> <plugins> <!-- SpringBoot啟動(dòng) --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> </includes> <filtering>true</filtering> </resource> </resources> </build> </project>
2、看兩種啟動(dòng)方式不同進(jìn)行訪問jsp頁(yè)面
第一種,直接maven啟動(dòng)
可以直接訪問jsp
第二種
寫一個(gè)類來達(dá)到訪問的目的
訪問是一樣的,這兩種方法都可以選擇,這是我百度了很久找出來的法子!可以解決springboor訪問jsp的問題!
補(bǔ)充一下 這里的File里面的路徑是webapp的絕對(duì)路徑哦!
到此這篇關(guān)于解決SpringBoot啟動(dòng)過后不能訪問jsp頁(yè)面的問題的文章就介紹到這了,更多相關(guān)SpringBoot不能訪問jsp頁(yè)面內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Spring事務(wù)失效場(chǎng)景的詳細(xì)整理
Spring 事務(wù)的傳播特性說的是,當(dāng)多個(gè)事務(wù)同時(shí)存在的時(shí)候,Spring 如何處理這些事務(wù)的特性,下面這篇文章主要給大家介紹了關(guān)于Spring事務(wù)失效場(chǎng)景的相關(guān)資料,需要的朋友可以參考下2022-02-02Java中tomcat memecached session 共享同步問題的解決辦法
這篇文章主要介紹了Java中tomcat memecached session 共享同步問題的解決辦法的相關(guān)資料,需要的朋友可以參考下2015-10-10Spring Data MongoDB 數(shù)據(jù)庫(kù)批量操作的方法
在項(xiàng)目開發(fā)中經(jīng)常會(huì)批量插入數(shù)據(jù)和更新數(shù)據(jù)的操作,這篇文章主要介紹了Spring Data MongoDB 數(shù)據(jù)庫(kù)批量操作的方法,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2018-11-11Spring中如何動(dòng)態(tài)注入Bean實(shí)例教程
這篇文章主要給大家介紹了關(guān)于Spring中如何動(dòng)態(tài)注入Bean的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。2017-12-12Java實(shí)現(xiàn)的讀取資源文件工具類ResourcesUtil實(shí)例【可動(dòng)態(tài)更改值的內(nèi)容】
這篇文章主要介紹了Java實(shí)現(xiàn)的讀取資源文件工具類ResourcesUtil,結(jié)合實(shí)例形式分析了java針對(duì)資源文件的讀取與修改相關(guān)操作技巧,需要的朋友可以參考下2017-10-10