1. 程式人生 > >皕傑報表在springboot專案配置演示例項

皕傑報表在springboot專案配置演示例項

根據皕傑報表和springboot的整合這個方案,我們在springboot專案中配置了皕傑報表環境。這次我們怎麼在上個springboot專案基礎上配置演示專案index.Jsp。 1.在pom.xml裡新增支援jsp的 模組:

<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>javax.servlet-api</artifactId>
	<scope>provided</scope>
</dependency>
<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>jstl</artifactId>
</dependency>
<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>
	 <scope>provided</scope> 
</dependency>

2.新建Controller,設定訪問演示專案主頁的路徑

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping("/")
public class IndexController {
	@RequestMapping(value="/report")
	public String index() {
		System.out.println("============================================");
		return "bios_demo/index.jsp";  
	} 
}

3.修改springboot專案src/main/webapp下的bios_demo和bios_jsp資料夾裡的jsp檔案,將編碼格式改成utf-8

<%@page contentType="text/html; charset=gbk"%>

改為

<%@page contentType="text/html; charset=utf-8"%>

<meta http-equiv="Content-Type" content="text/html; charset=gbk">

改為

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

4.修改springboot專案src/main/webapp/WEB-INF/resources資料夾下的config.xml 將報表web編碼修改為”utf-8”

<!-- web編碼 -->
<characterEncode>utf-8</characterEncode>

5.啟動springboot專案,訪問http://localhost:8080/report 啟動成功,訪問報表