Hi everyone, i am problem with to display all registers from my DB (MySQL) on a Grid. i´m using java environment, look it the code. (i’m new dhtmlx user) haha
contactsGrid = layout.cells("a").attachGrid();
contactsGrid.setHeader("Name,Last Name,Email");
contactsGrid.setColumnIds("fname,lname,email");
contactsGrid.setInitWidths("200,200,*");
contactsGrid.setColAlign("left,left,left");
contactsGrid.setColTypes("ro,ro,ro");
contactsGrid.setColSorting("str,str,str");
contactsGrid.attachHeader("#text_filter,#text_filter,#text_filter");
contactsGrid.init();
contactsGrid.load("data/miConexion.jsp"); //file with db connection and more....
//process data
var dpg = new dataProcessor("data/miConexion.jsp");
//load on grid
dpg.init(contactsGrid);
now, “miConexion.jsp”.
String db_ipp_addr = "localhost";
String db_username = "root";
String db_password = "";
String db_name = "dhtmlx_tutorial";
// connect to database
Connection connection = null;
String connectionURL = "jdbc:mysql://" + db_ipp_addr + ":3306/" + db_name;
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, db_username, db_password);
GridConnector nuevo = new GridConnector(connection);
nuevo.render_table("contacts", "contact_id", "fname,lname,email");
Now. The error when run my project.
<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.3 - Informe de Error</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><body><h1>Estado HTTP 500 - Ha sucedido una excepción al procesar la página JSP /data/miConexion.jsp en línea 31</h1><div class="line"></div><p><b>type</b> Informe de Excepción</p><p><b>mensaje</b> <u>Ha sucedido una excepción al procesar la página JSP /data/miConexion.jsp en línea 31</u></p><p><b>descripción</b> <u>El servidor encontró un error interno que hizo que no pudiera rellenar este requerimiento.</u></p><p><b>excepción</b></p><pre>org.apache.jasper.JasperException: Ha sucedido una excepción al procesar la página JSP /data/miConexion.jsp en línea 31
28:
29:
30: GridConnector nuevo = new GridConnector(connection);
31: nuevo.render_table("contacts", "contact_id", "fname,lname,email");
32:
33:
34:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
</pre><p><b>causa raíz</b></p><pre>java.lang.NullPointerException
com.dhtmlx.connector.BaseConnector.parse_request(BaseConnector.java:491)
com.dhtmlx.connector.GridConnector.parse_request(GridConnector.java:69)
com.dhtmlx.connector.BaseConnector.render(BaseConnector.java:405)
com.dhtmlx.connector.BaseConnector.render_table(BaseConnector.java:242)
com.dhtmlx.connector.BaseConnector.render_table(BaseConnector.java:210)
org.apache.jsp.data.miConexion_jsp._jspService(miConexion_jsp.java:90)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
</pre><p><b>nota</b> <u>La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/8.0.3.</u></p><hr class="line"><h3>Apache Tomcat/8.0.3</h3></body></html>
I have done tests Connection, and was successful, I made a query, and returns me the data. the trouble is introduce these data, on my grid.
Someone can helpme?