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

252
Views
cómo obtener la matriz en el servlet que pasó de la llamada ajax

Estoy pasando una matriz del servlet a través de la llamada ajax. Pero cuando trato de obtener lo mismo en el lado del servlet, obtengo una excepción de puntero nulo. Intenté usar uno de los ejemplos dados en SO. Ya que soy un novato, ¡cualquier ayuda sería apreciada!

 $.ajax({ url : 'insertserv1', type: 'POST', dataType: 'json', data: {tablearray:tablearray} , contentType: 'application/json', mimeType: 'application/json', success : function(data) { alert('Hi'); } });

 // to get data from inspection table { var tablearray = []; $("#tab_logic tr.data").map(function (index, tr) { $(this).find('td').each(function(){ var $data = $(this).html(); if($(this).find("select").length > 0) { var $x = $(this).find("select").val(); }else{ var $x = $(this).find("input[type='text']").val(); } tablearray.push($x); }); }); }

 String[] tablearray = request.getParameterValues("tablearray[]"); for (int i = 0; i < tablearray.length; i++) { System.out.println(InspTableArray[i]); }

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Si he entendido bien, esto es lo que estarías buscando:

 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { JSONObject jObj = null; StringBuilder sb = new StringBuilder(); BufferedReader br = request.getReader(); String str = null; while ((str = br.readLine()) != null) { sb.append(str); } try { jObj = new JSONObject(sb.toString()); //This is your JSON data. } catch (JSONException e) { e.printStackTrace(); } }
over 4 years ago · Santiago Trujillo 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!