1、在全局定义一个变量:
#set($varName = "")
2、拼接字符串病截取字符串:
#foreach( $role in $adminUser.roles)
#set($varName=$varName+$role.roleName+",")
#end
#set($varName=$varName.substring(0,$varName.lastIndexOf(',')))
$varName