|
| 1 | +<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
| 2 | +<%@ page import="java.sql.*" %> |
| 3 | +<!DOCTYPE html> |
| 4 | +<html lang="en"> |
| 5 | +<head> |
| 6 | + <meta charset="UTF-8"/> |
| 7 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
| 8 | + <link rel="icon" type="image/png" href="images/favicon.png"/> |
| 9 | + <title>Art — Brarner.M.Alete™</title> |
| 10 | + <link rel="stylesheet" href="css/style.css"/> |
| 11 | +</head> |
| 12 | +<body> |
| 13 | +<nav class="nav"><div class="nav-inner"> |
| 14 | + <a href="index.jsp" class="nav-brand"><img src="images/mearvk.ltd.logo.left.png" alt="" style="height:40px;vertical-align:middle;margin-right:8px;background:transparent;"/>Brarner.M.Alete™<img src="images/mearvk.ltd.logo.right.png" alt="" style="height:40px;vertical-align:middle;margin-left:8px;background:transparent;"/></a> |
| 15 | + <ul class="nav-links"> |
| 16 | + <li><a href="index.jsp">Overview</a></li> |
| 17 | + <li><a href="species.jsp">Species</a></li> |
| 18 | + <li><a href="postal.jsp">Postal</a></li> |
| 19 | + <li><a href="art.jsp" class="active">Art</a></li> |
| 20 | + <li><a href="science.jsp">Science</a></li> |
| 21 | + <li><a href="status.jsp">Status</a></li> |
| 22 | + </ul> |
| 23 | + <div class="nav-actions"><a href="admin/login.xhtml" class="nav-cta">Admin →</a></div> |
| 24 | +</div></nav> |
| 25 | + |
| 26 | +<section class="hero" style="padding:4rem 2rem;"> |
| 27 | + <div class="hero-inner"> |
| 28 | + <span class="hero-tag">Museum Collections</span> |
| 29 | + <h1>Art Database</h1> |
| 30 | + <p>Art museum collections indexer covering 22 major institutions with species-linked natural art references.</p> |
| 31 | + </div> |
| 32 | +</section> |
| 33 | + |
| 34 | +<section class="section"> |
| 35 | + <div class="section-inner"> |
| 36 | +<% |
| 37 | + Connection conn = null; |
| 38 | + try { |
| 39 | + Class.forName("com.mysql.cj.jdbc.Driver"); |
| 40 | + conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/BrarnerScience", "root", ""); |
| 41 | +
|
| 42 | + String museum = request.getParameter("museum"); |
| 43 | + if (museum != null && !museum.isEmpty()) { |
| 44 | + PreparedStatement ps = conn.prepareStatement( |
| 45 | + "SELECT title, artist, year_created, medium FROM art_works WHERE museum_name=? ORDER BY title LIMIT 200"); |
| 46 | + ps.setString(1, museum); |
| 47 | + ResultSet rs = ps.executeQuery(); |
| 48 | +%> |
| 49 | + <h3>Works at <%= museum %></h3> |
| 50 | + <p><a href="art.jsp">← Back to museums</a></p> |
| 51 | + <div class="table-wrap"> |
| 52 | + <table> |
| 53 | + <thead><tr><th>Title</th><th>Artist</th><th>Year</th><th>Medium</th></tr></thead> |
| 54 | + <tbody> |
| 55 | +<% |
| 56 | + boolean hasRows = false; |
| 57 | + while (rs.next()) { hasRows = true; %> |
| 58 | + <tr> |
| 59 | + <td><%= rs.getString("title") != null ? rs.getString("title") : "" %></td> |
| 60 | + <td><%= rs.getString("artist") != null ? rs.getString("artist") : "" %></td> |
| 61 | + <td><%= rs.getString("year_created") != null ? rs.getString("year_created") : "" %></td> |
| 62 | + <td><%= rs.getString("medium") != null ? rs.getString("medium") : "" %></td> |
| 63 | + </tr> |
| 64 | +<% } |
| 65 | + if (!hasRows) { %> |
| 66 | + <tr><td colspan="4">No works found.</td></tr> |
| 67 | +<% } rs.close(); ps.close(); |
| 68 | +%> |
| 69 | + </tbody> |
| 70 | + </table> |
| 71 | + </div> |
| 72 | +<% |
| 73 | + } else { |
| 74 | + PreparedStatement ps = conn.prepareStatement( |
| 75 | + "SELECT museum_name, COUNT(*) AS works FROM art_works WHERE museum_name IS NOT NULL GROUP BY museum_name ORDER BY museum_name"); |
| 76 | + ResultSet rs = ps.executeQuery(); |
| 77 | +%> |
| 78 | + <h3>Museums</h3> |
| 79 | + <div class="table-wrap"> |
| 80 | + <table> |
| 81 | + <thead><tr><th>Museum</th><th>Works</th></tr></thead> |
| 82 | + <tbody> |
| 83 | +<% |
| 84 | + boolean hasRows = false; |
| 85 | + while (rs.next()) { hasRows = true; String m = rs.getString("museum_name"); %> |
| 86 | + <tr><td><a href="art.jsp?museum=<%= java.net.URLEncoder.encode(m, "UTF-8") %>"><%= m %></a></td><td><%= rs.getInt("works") %></td></tr> |
| 87 | +<% } |
| 88 | + if (!hasRows) { %> |
| 89 | + <tr><td colspan="2">No art data available.</td></tr> |
| 90 | +<% } rs.close(); ps.close(); |
| 91 | +%> |
| 92 | + </tbody> |
| 93 | + </table> |
| 94 | + </div> |
| 95 | +<% |
| 96 | + } |
| 97 | + } catch (Exception e) { %> |
| 98 | + <p style="color:#ef4444;">Database error: <%= e.getMessage() != null ? e.getMessage().replace("<","<") : "unknown" %></p> |
| 99 | +<% } finally { if (conn != null) try { conn.close(); } catch (Exception ignored) {} } |
| 100 | +%> |
| 101 | + </div> |
| 102 | +</section> |
| 103 | + |
| 104 | +<footer class="footer"><div class="footer-bottom" style="border:none;padding:0;"> |
| 105 | + <span>© 2026 MEARVK LLC. All rights reserved.</span> |
| 106 | +</div></footer> |
| 107 | +</body> |
| 108 | +</html> |
0 commit comments