load select option with variable spring

0

I have a populated table with <c:foreach> and in one of the colums I have a 'ALTER' I click on it and I load the information I want to change on another page. Already on the other page, the information I wanted to popular my select option according to the information I brought via ID.

EX : In my carregaModal below I only bring 2 'Defensive' and 'Aggressive' things I wanted to already load with one or the other when load page.

${carregaModal.caracteristica

HTML

<div class="form-group">
    <label>Característica</label>
    <div>
        <select name="caracteristica" class="form-control">
            <option>Defensivo</option>
            <option>Agressivo</option>
        </select>
    </div>
</div>
    
asked by anonymous 01.12.2017 / 21:02

1 answer

0

Oops, a lot of research and a little understanding, for those who had the same problem I follow as I decided.

                                             <select name="quadra" class="form-control">
                                                <option value="Rápida" ${carregaModal.quadra == 'Rápida'? 'selected' : '' }>Rápida</option>
                                                <option value="Saibro" ${carregaModal.quadra == 'Saibro'? 'selected' : '' }>Saibro</option>
                                                <option value="Grama" ${carregaModal.quadra == 'Grama'? 'selected' : '' }>Grama</option>
                                            </select>

if your select is on a

                                            <select name="modalidadeTemp" class="form-control">
                                                <c:forEach items="${listaModalidades}" var="listaModalidades">
                                                    <option value="${listaModalidades.nomeModalidadeTemp}" ${listaModalidades.nomeModalidadeTemp == carregaModal.modalidadeTemp ? 'selected' : ''}>${listaModalidades.nomeModalidadeTemp}</option>
                                                </c:forEach>
                                            </select>
    
02.12.2017 / 23:01