Select data from Firebird by means of JSTL in Netbeans 8

In last post I describe how create website in JSTL. In this post we select data from database and display them into table.

Open in Netbeans our NewJSTL project. Right click the Libraries node and choose Add JAR/Folder.

c30Choose from opened window jdbc driver for your database. On the list of libraries you see this jar file.

c40Open your index.jsp file and paste into it this code:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="" prefix="c"%>
<%@ taglib uri="" prefix="sql"%>
<!DOCTYPE html>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <h1>JSTL page selected data from database</h1>
        <sql:setDataSource  driver="org.firebirdsql.jdbc.FBDriver"
     user="SYSDBA"  password="masterkey"/> 
<sql:query var="result">SELECT * from testdb;</sql:query> 
<table border="1" width="100%">
<c:forEach var="row" items="${result.rows}">
   <td><c:out value="${}"/></td>
   <td><c:out value="${}"/></td>  


Change values connected to database , name of table and column for yours.

Check if you have connected to the database in Services window.

z15Run your application.