我在我的html中有一些重复选择标记,因此我想创建一个自定义选择标记,它将作为参数选择名称属性(可以完成很容易)和一个列表对象,我通过它动态地创建选项标签。playframework - 在自定义选择标记中设置列表参数
基本上我想要做这样的事情
////// custom tag stored in FormSelect.html///////
<select name="${_selectName}">
#{list ${_options}, as: 't'}
<option value="${t.Description}"> ${t.Description} </option>
#{/list}
</select>
///////calling the custom tag from another html file//////////
Type:
#{FormSelect selectName:'typ', options:types /}
Region:
#{FormSelect selectName:'reg', options:regions /}
类型和地区变量矢量和控制器转发。我想$ {_选项}在选择标签(内#{list}里)当我excecute上面的代码我得到这个例外,拿类型和地区
值
Template execution error
Execution error occured in template /app/views/tags/FormSelect.html. Exception raised was MissingMethodException : No signature of method: Template_1002.$() is applicable for argument types: (Template_1002$_run_closure1_closure2) values: [[email protected]] Possible solutions: _(java.lang.String), is(java.lang.Object), run(), run(), any(), get(java.lang.String).
In /app/views/tags/FormSelect.html (around line 2)
1: <select name="${_selectName}">
2: #{list ${_options}, as: 't'}
3: <option value="${t.Description}"> ${t.Description} </option>
4: #{/list}
5: </select>
THX提前
你有什么问题?你会得到什么错误?你有没有试过这段代码?Vector中的类是什么?他们的代码? –
好的谢谢你的回复,是的,我试过了代码,我得到一些异常,请检查第一篇文章 – hari