| Цитата | Оказывается DataGrid с привязкой к JDBC существует - http://www.codeproject.com/useritems/DBGrid.asp.
|
Я нашел другое, которое работает, така как хотелось: http://sourceforge.net/projects/displaytag И вот, что у меня с ним получилось:
| Код | <jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:sql="http://java.sun.com/jsp/jstl/sql" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:display="urn:jsptld:http://displaytag.sf.net"> <jsp:directive.page contentType="text/html; charset=UTF-8" /> <style type="text/css" media="all"> @import url("css/maven-base.css"); @import url("css/maven-theme.css"); @import url("css/site.css"); @import url("css/screen.css"); </style> <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" /> <html> <head> <title>Factory Test</title> </head> <body> <center> <table style="border:0; border-collapse: collapse; width: 15%; cellpadding: 0; margin-top: 0; margin-bottom: 0" > <tr> <td> <form method="get"> <input type="hidden" name="status" /> <input type="submit" value="All" /> </form> </td> <td> <form method="get"> <input type="hidden" name="status" value="1" /> <input type="submit" value="Active" /> </form> </td> <td> <form method="get"> <input type="hidden" name="status" value="0" /> <input type="submit" value="Inactive" /> </form> </td> </tr> </table> <c:if test="${empty param['status']}"> <sql:query var="rs" dataSource="jdbc/fact"> SELECT tabnom, lastname, name, phone, namejob, status FROM jobs, staff WHERE jobs.job_id = staff.job_id </sql:query> </c:if> <c:if test="${not empty param['status']}"> <sql:query var="rs" dataSource="jdbc/fact"> SELECT tabnom, lastname, name, phone, namejob, status FROM jobs, staff WHERE jobs.job_id = staff.job_id and jobs.status = "${param['status']}" </sql:query> </c:if> <display:table name="pageScope.rs.rows" id="row" pagesize="3" defaultsort="1" defaultorder="ascending" > <display:column property="tabnom" title="Tab Nom" /> <display:column property="lastname" title="Fam" sortable="true" headerClass="sortable" /> <display:column property="name" title="Name" /> <display:column property="phone" title="Phone" /> <display:column property="namejob" title="Job" sortable="true" headerClass="sortable" /> <c:set var="Actions" value="${row.tabnom}" /> <display:column title="Action" > <display:table name="${Actions}" class="simple1" > <display:column href="edit.jsp" scope="session" value="Edit" /> <display:column href="delete.jsp" scope="session" value="Delete" /> </display:table> </display:column> </display:table> <form method="GET" action="new.jsp"> <input type="submit" value="New employee" /> </form> </center> </body> </html> </jsp:root>
|
dataSource беру из Connection Pool. |