<%@ page import="java.sql.*,javax.naming.*,javax.sql.*" %> Spagetti JSP (pool)

Spagetti JSP (pool)

Show:

<% Context initctx = new InitialContext(); Context envctx = (Context)initctx.lookup("java:/comp/env"); DataSource ds = (DataSource)envctx.lookup("jdbc/TestDB"); Connection con = ds.getConnection(); PreparedStatement pstmt = con.prepareStatement("SELECT f1,f2 FROM t1"); ResultSet rs = pstmt.executeQuery(); while(rs.next()) { int f1 = rs.getInt(1); String f2 = rs.getString(2); %> <% } rs.close(); pstmt.close(); con.close(); %>
F1 F2
<%=f1%> <%=f2%> Delete

Add:

F1:
F2: