[英]how to display values in select tag as 10,15,20,25 using grails select tag
[英]How to display a select tag in grails
我已經在form.gsp
頁面中輸入了此標簽以顯示select
但它不起作用。您能幫我找到我遇到的錯誤嗎?
<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'role', 'error')} required">
<label for="role">
<g:message code="user.role.label" default="Role" />
<span class="required-indicator">*</span>
</label>
<g:select id="role" name="role.id" from="${taskmanagement1.secu.Role.list()}" optionKey="id" required="" value="${userInstance?.role?.id}" class="many-to-one"/>
</div>
注意:我正在使用Spring Security生成的Role&User域類。
您可以嘗試一下嗎,我沒有測試過,但認為可以
<g:select name="role.id" from="${taskmanagement1.secu.Role.list()}" optionKey="id" value="${userInstance.role*.id}" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.