简体   繁体   中英

How to display a select tag in grails

I had entered this tag in a form.gsp page in order to diplay a select but it doesn't work .Can you help me to find the error i have ?

    <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>

NB: I'm using Role & User domain classes generated by Spring Security .

您可以尝试一下吗,我没有测试过,但认为可以

<g:select name="role.id" from="${taskmanagement1.secu.Role.list()}" optionKey="id" value="${userInstance.role*.id}" /> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM