Hi,
When displayed in Tomcat, the following piece of JSP code display a LOV/drop-down list.
How can I get such a LOV in a true HTML-page or block like ?:
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<title>This is a title</title>
</head>
<body>
<h1>This is a h1 size text</h1>
[Here should the LOV as a drop-down field be defined with a label/name]
</body>
</html>
JSP code:
<%@ page import="java.sql.*, javax.naming.*, javax.sql.*" %>
<%
Context initContext = new InitialContext();
Context envContext = (Context) initContext.lookup("java:/comp/env");
DataSource ds = (DataSource) envContext.lookup("jdbc/postgres-14-webs1");
Connection conn = ds.getConnection();
%>
<select name="image_id">
<%
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT id FROM images_resized");
while (rs.next()) {
out.println("<option value=\"" + rs.getString("id") + "\">" + rs.getString("id") + "</option>");
}
rs.close();
stmt.close();
conn.close();
%>
</select>
Kind Regards