freemarker中的if...elseif...else语句

 

1、设计示例

 

<#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>

 

 

2、运行结果

student.studentAge为20,student.studentName为张三丰

 

 张三丰是一个大学生