-
对于NUL或不存在的值取值时,需要${var!'默认值'}查看全部
-
<ul> <li><font size="20px" color="red">整数:${intVar}</font></li> <li><font size="20px" color="blue">长整数:${LongVar}</font></li> <li><font size="20px" color="pink">浮点数:${doubleVar}</font></li> <li><font size="20px" color="yellow">字符串:${StringVar}</font></li> <li><font size="20px" color="green">布尔值: ${booleanVar?string('yes','no')}</font></li> <li><font size="20px" color="blue"></font></li> <li><font size="20px" color="blue"></font></li> </ul>查看全部
-
package com.spring.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/") public class FreemarkerController1 { //freemarker取值,插值 @RequestMapping("/free1") public ModelAndView free1(){ ModelAndView mv1 = new ModelAndView(); mv1.addObject("intVar",100); mv1.addObject("LongVar",10000000000000000L); return mv1; } } <ul> <li><font size="20px" color="red">整数:${intVar}</font></li> <li><font size="20px" color="blue">长整数:${LongVar}</font></li> </ul>查看全部
-
JAVA中常用的数据模型 基本类型数据(比如Integer) 封装的对象类型(比如User对象) 集合类型(List Map) 取值指令 常用${var}语法进行取值 对null、不存在对象取值${var!} 取包装对象的值,通过“点”语法:${User.name}查看全部
-
freemarker取值指令查看全部
-
freemarker Java中常用的数据类型查看全部
-
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <style type="text/css"> h1{ color:red; font-size:40px; } </style> </head> <body> <h1>${username}</h1> <#assign var="hello spring boot 学习你很开心!"/> <font size="18px">${var}</font> </body> </html>查看全部
-
freemarker配置 #服务端口 server.port=8080 #freemarker配置 spring.freemarker.cache=false spring.freemarker.checkTemplateLocation=true spring.freemarker.contentType=text/html spring.freemarker.suffix=.html spring.freemarker.templateEncoding=UTF-8 spring.freemarker.templateLoaderPath=classpath:/templates/查看全部
-
项目启动入口查看全部
-
Freemarker list遍历查看全部
-
列表展示查看全部
-
Freemarker配置文件查看全部
-
Freemarker项目查看全部
-
Freemarker数据输出查看全部
-
Freemarker是一个基于Java语言的模板引擎,不是web框架,是一个试图层的组件,主要用于解析服务器端的数据,并展示到视图层。查看全部
举报
0/150
提交
取消