tengo el siguiente problema: Resulta que debo desplegar datos en una tabla, que provienen de un web service, pero lo que necesito es obtener el id de ese dato y enviarlo a otro web service para obtener los datos de ese en especifico.
Para ello cree la variable "seleccion" con jsp fuera de la tabla:
<%
int seleccion = 0;
%>
Luego tengo la tabla de la siguiente forma, llenada con los datos que llamo del web service:
<table class="table table-dark table-hover">
<thead>
<tr>
<th>ID</th>
<th>Equipo</th>
<th>Fecha</th>
<th>Hora</th>
<th>Dirección</th>
<th>Estado</th>
<th>Opciones</th>
</tr>
</thead>
<tbody>
<%
for (int i = 0; i < lista.size(); i++) {
%>
<tr>
<td><% out.println(lista.get(i).getIdInspeccion()); %></th>
<td><% out.println(lista.get(i).getNombreEquipo()); %></td>
<td><% out.println(lista.get(i).getFecha()); %></td>
<td><% out.println(lista.get(i).getHora()); %></td>
<td><% out.println(lista.get(i).getDireccion()); %></td>
<td><% out.println(lista.get(i).getEstadoInspeccion()); %></td>
<td>
<input type="text" value="<% out.println(lista.get(i).getIdInspeccion()); %>" id="insid">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="" onclick="" >Actualizar</button>
<button onclick="alert(<% out.println(seleccion); %>);">prueba</button>
</td>
</tr>
<%
}
%>
</tbody>
</table>
Como pueden ver al presional el boton opciones, se despliega un modal, el cual lo saque de bootstrap, entonces intento asignarle en ese lugar, el id de ese dato a la variable que cree anteriormente.
Luego con eso llamaria al web service:
<%
//ACA SE DEFINEN LAS VARIABLES PARA CARGAR LOS DATOS DE LA INSPECCION EN EL MODAL
int idIns = 0; //id
String estIns = ""; //estado
String resIns = ""; //resultado
%>
<%-- start web service invocation --%>
<%
try {
clienteWeb.ServicioGestionInspeccion_Service service = new clienteWeb.ServicioGestionInspeccion_Service();
clienteWeb.ServicioGestionInspeccion port = service.getServicioGestionInspeccionPort();
// TODO initialize WS operation arguments here
int idInspeccion = 0;
// TODO process result here
clienteWeb.Inspeccion result = port.obtenerResultado(seleccion);
//out.println("Result = " + result);
idIns = result.getIdInspeccion();
estIns = result.getEstadoInspeccion();
resIns = result.getResultado();
} catch (Exception ex) {
// TODO handle custom exceptions here
}
%>
<%-- end web service invocation --%>
En la parte donde le intento pasar el valor de la variable seleccion siempre me sale que es nulo:
clienteWeb.Inspeccion result = port.obtenerResultado(seleccion);
Como podria pasar el valor del id del dato de la tabla al web service?? muchas gracias!