我的html中有一些重复的select标记,因此我希望在播放中创建一个自定义的select标记,它将接受select的name属性(这很容易完成)和list对象,通过它动态创建选项标记。
基本上我想做这样的事
////// 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 /}类型为和区域,变量为Vector,由控制器转发。我希望${_options}在select标记(在#{list}内)接受类型和regions的值。
当我超出上述代码时,就会得到这个异常。
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: [Template_1002$_run_closure1_closure2@127a1d8] 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预先
发布于 2011-09-02 12:43:20
而不是
#{list ${_options}, as: 't'}
<option value="${t.Description}"> ${t.Description} </option>
#{/list}用途:
#{list items:_options, as: 't'}
<option value="${t.Description}"> ${t.Description} </option>
#{/list}这应该可以解决你当前的错误。
https://stackoverflow.com/questions/7282599
复制相似问题