freemarker之include指令(九)
freemarker之include指令
1、父页面ftl
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>学生信息</title>
</head>
<body>
<#include "/inc/top.ftl"/>
姓名:${student.studentName}
性别:${student.studentSex}
年龄:${student.studentAge}
生日:${(student.studentBirthday)?string("yyyy-MM-dd")}
地址:${student.studentAddr}
QQ:${student.studentQQ}
<#if student.studentAge lt 12>
${student.studentName}不是一个初中生
<#elseif student.studentAge lt 15>
${student.studentName}不是一个高中生
<#elseif student.studentAge lt 18>
${student.studentName}不是一个大学生
<#else>
${student.studentName}是一个大学生
</#if>
</body>
</html>
2、子页面ftl
<h1>欢迎,进入学生管理系统!</h1>
3、测试方法
Map<String,Object> root = null;
/**
*
* @Title:testStudent
* @Description:
* @param:
* @return: void
* @throws
*/
@Test
public void testStudent()
{
//创建数据模型
root = new HashMap<String,Object>();
root.put("student", new Student("张三丰","男",16,new Date(1988-12-12),"湖北省武汉市武昌洪山区",78451214));
student("student.ftl");
studentFile("student.ftl","student1.html");
}
/**
*
* @Title:student
* @Description:
* @param:@param name
* @return: void
* @throws
*/
private void student(String name)
{
ft.printFtl(name,root);
}
/**
*
* @Title:studentFile
* @Description:
* @param:@param name
* @param:@param fileName
* @return: void
* @throws
*/
private void studentFile(String name,String fileName)
{
ft.printFile(name, root, fileName);
}
4、生成HTML页面代码
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>学生信息</title>
</head>
<body>
<h1>欢迎,进入学生管理系统!</h1>
姓名:张三丰
性别:男
年龄:16
生日:1970-01-01
地址:湖北省武汉市武昌洪山区
QQ:78,451,214
张三丰不是一个大学生
</body>
</html>
freemarker之include指令(九)的更多相关文章
- freemarker之include指令
freemarker之include指令 1.父页面ftl <html> <head> <meta http-equiv="content-type" ...
- 20160331javaweb之JSP include 指令&&九大隐式对象
3.零散知识 (1)jsp映射 <servlet> <servlet-name>index</servlet-name> <jsp-file>/inde ...
- 重温JSP学习笔记--三大指令九大内置对象
最近在温习javaweb的相关基础知识,鉴于我弄丢了记满了整整一本的笔记,决定以后把笔记和一些学习上的心得以及碰到的一些问题统统都放在网上,今天看了一下jsp的相关基础,以下是笔记: JSP三大指令: ...
- Javaweb学习笔记——(十二)——————JSP指令:page指令、include指令、taglib指令,JavaBean,内省,EL表达式
JSP指令JSP指令分类 JSP有三大指令: *page指令 *include指令 *taglib指令 在JSP中没有任何指令是必须的. 但基本上每个JSP都是使用page指令============ ...
- FreeMarker之FTL指令
assign指令 此指令用于在页面上定义一个变量 (1)定义简单类型: <#assign linkman="周先生"> 联系人:${linkman} (2)定义对象类型 ...
- 浅谈JSP中include指令与include动作标识的区别
JSP中主要包含三大指令,分别是page,include,taglib.本篇主要提及include指令. include指令使用格式:<%@ include file="文件的绝对路径 ...
- JSP(include指令与<jsp:include>动作的区别)
<%@ page language= "java" contentType="text/html;charset=UTF-8" %><html ...
- jsp include指令
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"% ...
- include指令和include标签的区别
区别 类别 语法 发生作用时间 包含的内容 转化成Servlet 编译时间 运行时间 include指令 <%@ include file="" %> 页面交换 实际内 ...
随机推荐
- [转载]完全版线段树 by notonlysuccess大牛
原文出处:http://www.notonlysuccess.com/ (好像现在这个博客已经挂掉了,在网上找到的全部都是转载) 今天在清北学堂听课,听到了一些很令人吃惊的消息.至于这消息具体是啥,等 ...
- BZOJ 4555: [Tjoi2016&Heoi2016]求和 [分治FFT 组合计数 | 多项式求逆]
4555: [Tjoi2016&Heoi2016]求和 题意:求\[ \sum_{i=0}^n \sum_{j=0}^i S(i,j)\cdot 2^j\cdot j! \\ S是第二类斯特林 ...
- BZOJ 1937: [Shoi2004]Mst 最小生成树 [二分图最大权匹配]
传送门 题意: 给一张无向图和一棵生成树,改变一些边的权值使生成树为最小生成树,代价为改变权值和的绝对值,求最小代价 线性规划的形式: $Min\quad \sum\limits_{i=1}^{m} ...
- HDU 2141 Can you find it? [二分]
Can you find it? Give you three sequences of numbers A, B, C, then we give you a number X. Now you n ...
- ------- 软件调试——注销 QQ 过滤驱动设置的事件通知 CallBack (完)-------
---------------------------------------------------------------------------------- 本系列的最后一篇演示如何通过调试手 ...
- Linux 虚拟IP
虚拟IP Linux网卡上绑定另一个虚拟ip,即网卡上一个真实ip一个虚拟ip.当然通过这2个ip都可以连接到该主机. 实现原理主要是靠TCP/IP的ARP协议.因为ip地址只是一个逻辑 地址,在以太 ...
- 从Myeclipse到Intelj Idea
前言:经历了从eclipse到Myeclipse的时间,大学时候用Eclipse,开始工作的时候选择Myeclipse,都能体会到Java的IDE的先进和高明之处,直到最近,公司项目采git和Grad ...
- Winform下去除MDI窗体边框
做项目中间遇到了MDI窗体内边框的问题,经过苦苦寻找,最终得到了解决方案 在Main窗体中调用API // Win32 Constants ; ; private const int WS_BORDE ...
- Apache服务器安装-apache已经卸载,如何删除注册在系统的服务
cmd进入windows的命令行客户端,执行:sc delete apache 注意:以管理员的身份删除,同理,此方法也可以删除其他类似的服务.例如sc delete MongoDB.
- Linux Centos下编译安装Redis
需要安装 tcl 8.5 wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz //直接下载 sudo tar xzvf tcl8 ...