According to I see there are several things that you can validate that can prevent the recovery of the data:
The first thing to try is to use a request and not an arrayList that would be the proper way to retrieve the data from the view jsp
I'll give you an example:
//Recuperacion Id empresa
int empresa = Integer.parseInt(request.getParameter( "nIdeEmpresa" ));
// Se instancia los recursos del modelo y se da respuesta al request
// en esta parte validas el null (PARA ESTE CASO NO LO HAGO)
ClienteServise sr = new ClienteServise( );
ResultSet lista = sr.listaClienteServive( empresa );
// Se guarda el resultado de la operación No es necesario el list si no lo vas a tratar en el mismo servlet
// Instancia un Request para re-dirigir la data
request.setAttribute( "lista", lista );
// Redirecciona el flujo de ejecución hacia la vista jsp
RequestDispatcher vista = request.getRequestDispatcher( "listaClienteEmpresa.jsp" );
vista.forward(request, response);
In your view jsp you read the request that would be the appropriate way to read the data brought from the query.
In this example:
<%
// <!--MOSTRAR LA CONSULTA DE BD-->
ResultSet lista = (ResultSet)request.getAttribute( "lista" );
if(lista != null){
if( lista.first())
{
lista.beforeFirst();
out.println("<br /><br />"
+ "<form method='post' action=''>"
+ "<div style='overflow:auto' id='table_wrapper'>"
+ "<table border ='2px' align='center' id='list'>"
+ "<caption align='center'> LISTADO CLEINTES </caption>"
+ "<thead>"
+ "<tr>"
+ "<th>CLIENTE</th>"
+ "<th>ID CLIENTE</th>"
+ "<th>DIRECCION</th>"
+ "</tr>"
+ "</thead>");
while( lista.next( ) ){
out.println("<tr>"
+ "<td >" + lista.getString( 1 ) + "</td>"
+ "<td >" + lista.getString( 2 ) + "</td>"
+ "<td >" + lista.getString( 3 ) + "</td>");
}
out.println("</table>");
out.println("</div>");
out.println("</form>");
%>
It would be nice if you copied the code to do tests; the images make it difficult to make the exact examples.
Greetings!