SpringBoot

spring.datasource.username=root
spring.datasource.password=1234
spring.datasource.url=jdbc:mysql://localhost:3306/t202?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
//新版的驱动连接老版的数据库时要配Unicode

#模板引擎freemark配置
spring.freemarker.allow-request-override=false
spring.freemarker.request-context-attribute=req
spring.freemarker.suffix=.ftl
spring.freemarker.content-type=text/html;charset=utf-8
spring.freemarker.enabled=true
spring.freemarker.cache=false
spring.freemarker.template-loader-path=classpath:/templates/
spring.freemarker.charset=UTF-8
spring.freemarker.number_format=0.##

在springboot自动生成的**application.java中
列如:

package com.yps;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//扫描mapper的注解
@MapperScan(basePackages = "com.yps.mapper")
@SpringBootApplication
public class Springboot03Application {

    public static void main(String[] args) {
        SpringApplication.run(Springboot03Application.class, args);
    }

}

:springboot的模板引擎 tempate html、ftl…都放在这个文件夹,要通过控制器访问才能访问到,直接访问*.html访问不到.*

页面取值

${uname}

逻辑

${uname!"hhhh"}  <!--如果没有取到uname值那么就显示hhhh-->
${uname!} <!--如果没有就不显示-->

if

<# if state=="0"> <!--state:属性(填自己要判断的属性)-->
<# else if state=="1">
<# if>

迭代

<# List arr as li >
${li}
</# List>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值