springboot配置对jsp页面的解析支持

pom.xml文件配置依赖信息

<!--SpringBoot项目内嵌tomcat对jsp的解析包-->
<dependency>
   <groupId>org.apache.tomcat.embed</groupId>
   <artifactId>tomcat-embed-jasper</artifactId>
</dependency>

还有一些可选包

<!-- servlet依赖的jar包start ,可选-->
<dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>javax.servlet-api</artifactId>
</dependency>
<!-- servlet依赖的jar包start -->

<!-- jsp依赖jar包start ,可选-->
<dependency>
   <groupId>javax.servlet.jsp</groupId>
   <artifactId>javax.servlet.jsp-api</artifactId>
   <version>2.3.1</version>
</dependency>
<!-- jsp依赖jar包end -->

<!--jstl标签依赖的jar包start ,可选-->
<dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>jstl</artifactId>
</dependency>
<!--jstl标签依赖的jar包end -->

SpringBoot要求jsp文件必须编译到指定的META-INF/resources目录下才能访问,否则访问不到。

<resources>
   <resource>
      <!--源文件位置-->
      <directory>src/main/webapp</directory>
      <!--编译到META-INF/resources,该目录不能随便写-->
      <targetPath>META-INF/resources</targetPath>
      <includes>
         <!--要把哪些文件编译过去,**表示webapp目录及子目录,*.*表示所有-->
         <include>**/*.*</include>
      </includes>
   </resource>
</resources>

原文地址:https://www.cnblogs.com/Tpf386/p/11046757.html

时间: 2024-07-31 17:36:34

springboot配置对jsp页面的解析支持的相关文章

jsp页面:js方法里嵌套java代码(是操作数据库的),如果这个js 方法没被调用,当jsp页面被解析的时候,不管这个js方法有没有被调用这段java代码都会被执行?

jsp页面:js方法里嵌套java代码(是操作数据库的),如果这个js 方法没被调用,当jsp页面被解析的时候,不管这个js方法有没有被调用这段java代码都会被执行? 因为在解析时最新解析的就是JAVA代码,不管写哪里,都会最新被解析

springboot跳转jsp页面

springboot支持jsp页面跳转 官方不推荐jsp的支持,个人认为jsp在web层,用tomcat支持比较好 1.创建maven project项目 <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/

jsp采用数据库连接池的方法获取数据库时间戳context.xml配置,jsp页面把时间格式化成自己需要的格式

<?xml version="1.0" encoding="UTF-8"?> <!-- 数据库连接池配置文件 --> <Context> <Resource name="jdbc/ConnectionPool" auth="Application" type="javax.sql.DataSource" username="root" passw

jsp页面无法解析EL表达式

从eclipse迁移到idea,真是各种被坑. 今天遇到的jsp无法解析EL,页面直接就显示${xxx}好坑爹 Root cause:idea生成的web.xml 的web-app版本居然是2.3,2.3之后的版本才支持el表达式的 直接换成3.1的 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

JSP页面使用.html后缀

JSP页面默认不支持.html后缀 一.因为Tomcat容器问题 HTML页面默认使用org.apache.catalina.servlets.DefaultServlet JSP页面默认使用org.apache.jasper.servlet.JspServlet <!-- The mapping for the default servlet --><servlet-mapping> <servlet-name>default</servlet-name>

Equinox OSGi服务器应用程序的配置步骤 (支持JSP页面)

本文介绍在Eclipse里如何配置一个简单的基于Eclipse Equinox OSGi实现的Web应用程序,在它的基础上可以构造更加复杂的应用,本文使用的是Eclipse 3.3.1版本,如果你的Eclipse版本在3.2.0或以上应该都可以. 51CTO编辑推荐:OSGi入门与实践全攻略 一.支持静态页面和Servlet 1. 创建一个新的plugin项目, net.bjzhanghao.osgi.test,在向导第一步里选中“This plug-in is target,在下一步的“Plu

JSP页面EL表达式不解析

问题是这样:在搭建springMVC环境的时候,笔者写了一个简单的Controller如下: @Controller public class HelloController { @RequestMapping(value = "/hello.do", method = RequestMethod.GET) public String hello(Model model) { model.addAttribute("hello", "hello_Sprin

springboot集成jsp,访问jsp页面下载问题

1.导入相关依赖     (存在jsp页面下载问题,可能是缺少tomcat-embed-jasper的依赖对jsp的支持) <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.8.RELEASE</version> <relativeP

SpringMVC 返回JSON和JSP页面xml配置

SpringMVC 返回JSON和JSP页面xml配置 代码1: <!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --> <!-- Enables the Spring MVC @Controller programming model --> <annotation-driven /> <!-- Handles HTTP GET re