Home > front end >  delete row composite key in table jsp
delete row composite key in table jsp

Time:01-26

How can I delete row of table with dinamic delete button it works for single id but in this case that is for a compositekey how can i pass the value of both ids to component

<table border="1" cellpadding="5" >
    <tr>
        <th>Fecha</th>
        <th>Actividad</th>
        
    </tr>
    <c:forEach items="${listFechaActividad}" var="fechaActividad">
    <tr>
        <td>${fechaActividad.fecha}</td>
        <td>${fechaActividad.actividad}</td>
        
        <td>
              <!-- composite key -->
            <a href="delete?id=${fechaActividad.fecha}" >Delete</a>
            
        </td>
    </tr>
    </c:forEach>
</table>


@RequestMapping("/delete")
public String deleteForm(@RequestParam String id) {
    ...
    return "redirect:/";        
}

CodePudding user response:

I fanilly made it work adding te other id in the string

<a href="delete?id=${fechaActividad.fecha}!${fechaActividad.actividad}" >Delete</a>
  • Related