首页 > 代码库 > play freamwork 页面的Html+Groovy模板中添加Java代码
play freamwork 页面的Html+Groovy模板中添加Java代码
使用%{}%格式
%{
if(wechatUser.province==null){
wechatUser.province="";
}
if(wechatUser.city==null){
wechatUser.city="";
}
String address=wechatUser.province+wechatUser.city;
int sexNum=wechatUser.sex;
String sex="";
if(1==sexNum){
sex=play.i18n.Messages.get("male");
}else if(2==sexNum){
sex=play.i18n.Messages.get("female");
}else if(0==sexNum){
sex=play.i18n.Messages.get("unknown");
}
String language=wechatUser.language;
String languageName="";
if("en".equals(language)){
languageName="English";
}else if("zh_CN".equals(language)){
languageName="Chinese";
}
}%
play freamwork 页面的Html+Groovy模板中添加Java代码