Javatpoint Logo

jquery table grid example

By: maulik*** On: Sat Mar 10 09:15:35 IST 2018     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
<%@page import="java.util.List"%>
<%@page import="com.pojo.UserDao"%>
<%@page import="com.pojo.user"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href=" https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href=" https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap.min.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src=" https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap.min.js"></script>

<script>
$(document).ready(function() {
$('#example').DataTable();
} );
</script>
<title>Insert title here</title>
</head>
<body>
<h1 align="center">Show All Database</h1>
<a href="userhome.jsp" style="font-size: 20px;">Back Page</a>

<hr/>
<table id="example" class="table table-striped table-bordered" width="100%" cellspacing="0">

<thead>
<tr>
<th> ID</th>
<th>Username</th>
<th>Password</th>
<th>Email</th>
<th>Country</th>
<th>Gender</th>
<th>Mobile</th>
<th>Action</th>
</tr>
</thead>
<tbody>

<%
UserDao userDao = new UserDao();
List<user> list = userDao.getalldata();
for (user u : list) {
%>
<tr>
<td><%=u.getId()%></td>
<td><%=u.getName()%></td>
<td><%=u.getPassword()%></td>
<td><%=u.getEmail()%></td>
<td><%=u.getCountry()%></td>
<td><%=u.getGender()%></td>
<td><%=u.getMobile()%></td>
<td>
<a href="Login?action=edit&id=<%=u.getId()%>">edit</a>  
<a onclick="return confirm('Are You Sure');" href="Login?action=delete&id=<%=u.getId()%>">delete</a>

</td>


</tr>
<%}%>
<tbody>
</table>

<hr/>
</body>
</html>
Up0Down