Foros del Web » Programación para mayores de 30 ;) » Java »

Jqgrid con jsp usando json

Estas en el tema de Jqgrid con jsp usando json en el foro de Java en Foros del Web. Hola Amigos, por favorrrrrrrr necesito de su gran ayuda, el problema que tengo es el siguiente: estoy implementando el JQGRID usando JSON pero al momento ...
  #1 (permalink)  
Antiguo 29/03/2011, 10:27
 
Fecha de Ingreso: diciembre-2009
Mensajes: 23
Antigüedad: 14 años, 4 meses
Puntos: 0
Pregunta Jqgrid con jsp usando json

Hola Amigos, por favorrrrrrrr necesito de su gran ayuda, el problema que tengo es el siguiente:
estoy implementando el JQGRID usando JSON pero al momento de correo el programa no muestra informacion alguna y lo peor de todo es que realizo el DEBUG con eclipse y no me muestra error alguno.

miren esta es mi JSP RegistrarFichaTecnica.jsp que contiene el JQGRID en el cual invoco al
Datos_RegistrarFichaTecnica.jsp el cual contiene el JSON

Código HTML:
Ver original
  1. <script type="text/javascript">
  2. jQuery(document).ready(function(){
  3.   jQuery("#grid").jqGrid({
  4.       url:'Datos_RegistrarFichaTecnica.jsp',
  5.       datatype: "json",
  6.       mtype: 'GET',
  7.       colNames:['codigo','A paterno', 'A materno','Nombre','F.Nac','Cargo','C.costo'],
  8.       colModel:[
  9.  
  10.                 {name:'PLCODI', index:'PLCODI', width:55},
  11.                 {name:'PLAPEP', index:'PLAPEP', width:90},
  12.                 {name:'PLAPEM', index:'PLAPEM', width:80, align:'right'},
  13.                 {name:'PLNOM1', index:'PLNOM1', width:80, align:'right'},
  14.                 {name:'PLFNAC', index:'PLFNAC', width:80, align:'right'},
  15.                 {name:'PLCARG', index:'PLCARG', width:150 },
  16.                 {name:'PLCCOS', index:'PLCCOS', width:150},
  17.                
  18.                ],
  19.      
  20.       rowNum:10,
  21.       rowList:[10,20,30],
  22.       pager: jQuery('#gridpager'),
  23.       sortname: 'PLCODI',
  24.       viewrecords: true,
  25.       sortorder: "asc",
  26.       caption:"Wines"
  27.      
  28.  }).navGrid('#gridpager');
  29. });
  30.  
  31.  
  32.  
  33.  
  34. </head>
  35. <div id="jqgrid">
  36.     <table id="grid"></table>
  37.     <div id="gridpager"></div>
  38. </div>
  39.  
  40. </body>
  41. </html>


esta el JSP Datos_RegistrarFichaTecnica.jsp que contiene el JSON por favor amigos, si estoy pooniendo algo mal sean tan generosos de decirme cual es el error, muchas gracias

Código HTML:
Ver original
  1. <&#37;  
  2. String rows=request.getParameter("rows");    
  3.  
  4. String pageno=request.getParameter("page");        
  5. String cpage=pageno;          
  6. Connection connect = null;        
  7. Statement statement = null;        
  8. PreparedStatement preparedStatement = null;        
  9. ResultSet rs= null;        
  10.      
  11. connect = Conexion.connect();  
  12. statement = connect.createStatement();        
  13.          
  14. int count=0;        
  15.        
  16. count=11;        
  17. int  pageval=0;      
  18. pageval=(count/Integer.parseInt(rows));          
  19. int limitstart=0;          
  20. limitstart=(Integer.parseInt(rows)*Integer.parseInt(pageno))-Integer.parseInt(rows);        
  21. int total=count/Integer.parseInt(rows);        
  22. String totalrow=String.valueOf(total+1);          
  23. rs = statement.executeQuery("SELECT PLCODI, PLAPEP,PLAPEM, PLNOM1, \n" + "PLFNAC,PLCARG,PLCCOS  \n" +"FROM SPEED400EM.TPERS \n" + "ORDER BY PLAPEP  Fetch First "+rows+" Row Only " );
  24.          
  25. JSONObject responcedata=new JSONObject();        
  26. net.sf.json.JSONArray cellarray=new net.sf.json.JSONArray();          
  27. responcedata.put("total",totalrow);        
  28. responcedata.put("page",cpage);        
  29. responcedata.put("records",count);        
  30. net.sf.json.JSONArray cell=new net.sf.json.JSONArray();        
  31. net.sf.json.JSONObject cellobj=new net.sf.json.JSONObject();        
  32. int i=1;        
  33. while(rs.next())          
  34. {                
  35.    
  36.     cellobj.put("PLCODI",rs.getString(1));              
  37.     cell.add(rs.getString(1));                
  38.     cell.add(rs.getString(2));            
  39.     cell.add(rs.getString(3));
  40.     cell.add(rs.getString(4));                
  41.     cell.add(rs.getString(5));            
  42.     cell.add(rs.getString(6));  
  43.     cell.add(rs.getString(7));      
  44.     cellobj.put("cell",cell);        
  45.     cell.clear();        
  46.     cellarray.add(cellobj);
  47.     i++;        
  48.     }        
  49. responcedata.put("rows",cellarray);    
  50. out.println(responcedata);
  51.  
  52.  
  53. %>

Última edición por JonaRock; 29/03/2011 a las 10:37 Razón: JSP, JSON, JQGRID, HTML, JAVA, JQUERY

Etiquetas: jqgrid, json, jsp, jsp-servlets
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:52.