After scanning though some documentation , still i cant use the datatable in the jsp page

After scanning though some documentation , still i cant use the datatable in the jsp page

wklamwklam Posts: 5Questions: 0Answers: 0
edited December 2013 in General
Hello everyone,
I am a newbie to programming. Recently i have setup a very simply jsp page(run on weblogic) which draw data from an oracle server using jndi and display the data in a table form.

i am very impressed by functionality of the datatable and want to use it in the jsp web.But I am missing of information of how to setting up a datatable in my webpage.

I have followed guideline in the documentation like the html should be well-defined etc.
But still cant use the datatable.
Any comment is highly appreciated.

Thanks.


Below is the souce code.


<!DOCTYPE html>
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.sql.*" %>










testpage






Column 1
Column 2
Column 3



<%
InitialContext initialContext = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)initialContext.lookup("jdbc.abc-ds");
java.sql.Connection conn = ds.getConnection();

String sql = "select * from test_table";
java.sql.ResultSet rs = null;
java.sql.Statement s = null;
java.sql.PreparedStatement pst = null ;

try{
s = conn.createStatement();
rs = s.executeQuery(sql);
%>

<%
while(rs.next() ){
%>

<%= rs.getString("a") %>
<%= rs.getString("b") %>
<%= rs.getString("c") %>
<%= rs.getString("d") %>

<%
}
%>
<%

}catch(Exception e){

e.printStackTrace();

}finally{
if(rs!=null) rs.close();
if(s!=null) s.close();
if(conn!=null) conn.close();
}
%>




$(document).ready( function () {
$('#table_id').dataTable();
} );

Replies

  • wklamwklam Posts: 5Questions: 0Answers: 0
    ah .....i didnt use the css file , is it a problem ?
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    If you want styling then yes, that would be a problem. However, that wouldn't account for the table not working at all. Please link to a test page showing the issue so we can debug it and offer some help.

    Allan
  • wklamwklam Posts: 5Questions: 0Answers: 0
    edited December 2013
    Thanks Allan! Finally got the problem solved. It was caused by a wrong lib import path.
This discussion has been closed.