<!--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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.cn</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>test</name> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
#src/main/java/application.properties
server.port=8080
server.tomcat.uri-encoding=UTF-8
server.tomcat.access-log-enabled=true server.tomcat.basedir=./
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
//Application.java
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.support.SpringBootServletInitializer; /**
* Hello world!
*
*/
@SpringBootApplication
public class Application extends SpringBootServletInitializer{ public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; @Controller
public class IndexController {
@RequestMapping(value="/")
//@ResponseBody
public String indexPage(Model model){
model.addAttribute("say", "hello world");
return "index";
} }
<!--src/main/webapp/WEB-INFO/jsp/index.jsp-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
${say}
</body>
</html>

spring boot 1.4.1 with jsp file sample的更多相关文章

  1. Spring Boot (二)集成Jsp与生产环境部署

    一.简介 提起Java不得不说的一个开发场景就是Web开发,也是Java最热门的开发场景之一,说到Web开发绕不开的一个技术就是JSP,因为目前市面上仍有很多的公司在使用JSP,所以本文就来介绍一下S ...

  2. Spring Boot + Jersey发生FileNotFoundException (No such file or directory)

    我在使用Spring Boot + Jersey 项目,解决了上一篇随笔中的FileNotFoundException,然后又报了一个FileNotFoundException,不过报错信息不一样了 ...

  3. idea中spring boot启动后无法访问jsp

    出自:https://www.jianshu.com/p/470b28d76147 第一种: 打开File > Project Structure > Facetes 如图1: 图1 如果 ...

  4. Spring boot(二) springboot + jsp

    官方不推荐JSP在Spring Boot中使用! 一.添加依赖 在pim.xml 里面添加以下 jsp依赖 <dependency> <groupId>org.springfr ...

  5. Spring Boot开发Web应用之JSP篇

    前言 上一篇介绍了Spring Boot中使用Thymeleaf模板引擎,今天来介绍一下如何使用SpringBoot官方不推荐的jsp,虽然难度有点大,但是玩起来还是蛮有意思的. 正文 先来看看整体的 ...

  6. Spring Boot学习笔记(一)与JSP整合

    项目结构展示 在webapp目录下面手动创建JSP的目录和web.xml 创建web.xml只是为了不报错,在SpringBoot的项目中实际上用不到web.xml 打开pom.xml把框住的地方改成 ...

  7. [Spring boot] Read values from external properties file

    Let's say we have a extral app.proporites file which contains some extra configuration: // resources ...

  8. Eclipse完成Maven + Spring Boot + Mybatis + jsp

    Spring Boot 完成WEB项目开发 开发工具:eclipse 框架:Maven:Spring Boot:Mybatis 界面:jsp:javascript:css 前言: 在SpringBoo ...

  9. Spring boot整合jsp

    这几天在集中学习Spring boot+Shiro框架,因为之前view层用jsp比较多,所以想在spring boot中配置jsp,但是spring boot官方不推荐使用jsp,因为jsp相对于一 ...

随机推荐

  1. JS思维之路菜鸟也能有大能量-序幕

    准备写一类关于Js的开发思想的文章,这系列文章需要有一定的js基础,在这里不会去说太多的js基础知识,因为这系列文章不是写基础东西,而是一种编程思想,如果你还是js新手,那么建议你有一定基础后再看. ...

  2. 【Android菜鸟学习之路】环境搭建问题-修改AVD Path

    更改avd默认路径

  3. OP和DBA相关的一些有用资源

    最近国外blog上看到的一片资源分享博文,精而全,于是转帖分享 Must-Read Books List First of all, I would like to share a list of b ...

  4. 伸展树(二)之 C++的实现

    概要 上一章介绍了伸展树的基本概念,并通过C语言实现了伸展树.本章是伸展树的C++实现,后续再给出Java版本.还是那句老话,它们的原理都一样,择其一了解即可. 目录1. 伸展树的介绍2. 伸展树的C ...

  5. 邮箱mail 发送类 ASP.NET C#

    没有牛B的设计模式,代码精练精练实用,功能齐全,调用简单 ..全全完完为码农考虑 MailSmtp ms = new MailSmtp("smtp.qq.com","12 ...

  6. Entity FrameWork 增删查改

    Add #region 1.0 新增+void Add() /// <summary> /// 新增 /// </summary> static void Add() { // ...

  7. 环信SDK与Apple Watch的结合(1)

    该系列是记录在apple watch上开发IM,用到了最近挺流行的环信IM SDK. 一.先来一段网上随处可查到的信息: 1.两种分辨率 1.65寸 312*390 1.5寸 272*340 2.开发 ...

  8. 随笔分类 - 无废话ExtJs系列教程

    随笔分类 - 无废话ExtJs系列教程 摘自:http://www.cnblogs.com/iamlilinfeng/category/385121.html ExtJs 入门教程 摘要: extjs ...

  9. jquery实现下拉框功能

    说不清楚,直接上图 <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtm ...

  10. 自定义动画方法animate

    animate的使用方法:animate(params,speed,callback); 例子:animate({ right: "-=600px",height:"+= ...