Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
Valor de configuración automática en JSP desplegable

Tengo problemas para obtener el valor automático de la base de datos y marcar el valor automático en la página de edición de la página

aquí el JSP

 <c:if test="${l.code == 'USER_NOT_BLOCK' }"> <td> <select class="selectpicker" id="value-${l.code}" name="value-${l.code}" multiple="multiple"> <c:forEach items="${listUser}" var="list"> <option value="${list}" >${list}</option> </c:forEach> </select> </td> </c:if>

y este el controlador

 public ModelAndView addPref(@RequestParam String code) throws Exception{ ModelAndView mv=null; List<SystemParameter> list = null; String listUser = ""; try { mv = new ModelAndView("page.pref.add"); list = this.sysParamService.getPreferenceDetail(code); listUser = this.userService.getUsername(); System.out.println(listUser.toString()); mv.addObject("list", list); mv.addObject("listUser", listUser); //this is the dropdown value mv.addObject("code", code); } catch(Exception e){ LOG.error("Exception at addPref()", e); } finally{ list = null; }

Estoy abierto a todas sus sugerencias, incluso usar javascript no es un problema

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El patrón genérico para seleccionar un valor en una lista con JSP es

 <c:set var="list" value="${fn:split('ONE,TWO,THREE,FOUR', ',')}"/> <c:set var="selectedItem" value="TWO"/> <select> <c:forEach items="${list}" var="item"> <option value="${item}" ${item == selectedItem ? 'selected':''}>${item}</option> </c:forEach> </select>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!