Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

136
Vistas
condition <c:when test=""> within jstl <c:forEach>

beforehand I have model.addattribute(list, 'list') in which list is a list of VOs Within each VO I have choices=[val1,val2,val3...] and in some VOs I have choices=[]

I want to make a code in which:

  1. if choice doesn't have values: text type input appears
  2. and when it has values: radio type input appears

no 2. works fine, but I'm having trouble with the condition within my when statement.

<c:when test="${empty ${one.survey_choices}}">

I have also tried

<c:when test="${empty one.survey_choices}">

but both don't work.

Here's my code:

<c:forEach items="${surveyList}" var="one">
  <tr>
    <td style="text-align: left">
      <h4 class="fw-bold text-center mt-3"></h4>
      <p class="fw-bold">${one.survey_idx}.${one.survey_question}</p>
      <div class="form-check mb-2">
        <c:choose>
          <c:when test="${empty ${one.survey_choices}}"> <!-- ERROR!!! -->
            <p>success!!!</p>
            <div class="input-group mb-3">
              <div class="input-group-prepend">
                <span class="input-group-text" id="basic-addon1">${one.survey_idx}.${one.survey_question}</span>
              </div>
              <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
            </div>
          </c:when>
          <c:otherwise>
            <c:forTokens items="${one.survey_choices}" var="choice" delims=",">
              <input class="form-check-input" type="radio" name="exampleForm" id="radioExample1" />
              <label class="form-check-label" for="radioExample1">
                <c:out value="${choice}" />
              </label>
            </c:forTokens>
          </c:otherwise>
        </c:choose>
      </div>
    </td>
  </tr>
</c:forEach>

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda