0
我想使用@helper.select
窗体播放2模板引擎,其中我应该指定Seq[(String,String)]
包含<options>
的数据。但我有List<Enum>
。我知道斯卡拉比较弱。转换列表<Enum>转换成Seq [(String,String)]
没有这种帮助我使用此代码填充<select>
:
@for(category <- Categories.values()){
<option value="@category">@Messages.get(category.getI18NName)</option>
}
和定义类别:
public enum Category{
CATEGORY1{
@Override
public String getI18NName(){
return "category.category1";
}
},
CATEGORY2{
@Override
public String getI18NName(){
return "category.category2";
}
};
public String getI18NName(){
return null;
}
}
为了测试我使用options = options("1" -> "1", "2" -> "2", "3" -> "3", "4" -> "4", "5" -> "5")
形式Java example of inputRadioGroup in Play2
我怎样才能得到Seq[(String,String)]
从我的List<Enum>
?
感谢
谢谢。完美的作品! – nickotinus 2013-03-07 17:50:51
来自Java的大提示,谢谢 – 2013-08-26 13:17:17