Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%
- String driverName = "com.mysql.jdbc.Driver";
- String connectionUrl = "jdbc:mysql://localhost:3306/";
- String dbName = "supr";
- String userId = "root";
- String password = "secret";
- try {
- Class.forName(driverName);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- Connection connection = null;
- Statement statement = null;
- ResultSet resultSet = null;
- ResultSet resultSet2 = null;
- %>
- <%
- try {
- connection = DriverManager.getConnection(
- connectionUrl + dbName, userId, password);
- statement = connection.createStatement();
- String sql = "SELECT con.container_id, con.con_location, con.con_status, concap.capacity FROM container con INNER JOIN con_capacity concap ON con.container_id = concap.container_id";
- String sql2 = "SELECT p.pipe_id, p.pipe_location, pd.PipeDis_date FROM pipe p JOIN pipe_disinfect pd ON p.pipe_id = pd.pipe_id ";
- resultSet = statement.executeQuery(sql);
- resultSet2 = statement.executeQuery(sql2);
- %>
- <table class="table table-hover">
- <thead>
- <th>Container ID</th>
- <th>Location</th>
- <th>Status</th>
- <th>Capacity</th>
- <th></th>
- </thead>
- <tbody>
- <%
- while (resultSet.next()) { %>
- <tr>
- <td><%=resultSet.getString("Container_ID")%></td>
- <td><%=resultSet.getString("Con_Location")%></td>
- <td><%=resultSet.getString("Con_Status")%></td>
- <td><%=resultSet.getString("Capacity")%></td>
- <td><button class="btn btn-primary">Schedule</button></td>
- </tr>
- </tbody>
- <%
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- %>
- </table>
- <table class="table table-hover">
- <thead>
- <th>Pipe ID</th>
- <th>Location</th>
- <th>Last Disinfection</th>
- <th></th>
- </thead>
- <tbody>
- <%
- while (resultSet2.next()) { %>
- <tr>
- <td><%=resultSet2.getString("Pipe_ID")%></td>
- <td><%=resultSet2.getString("Pipe_Location")%></td>
- <td><%=resultSet2.getString("Pipe_LastDisinfect")%></td>
- <td><button class="btn btn-primary">Schedule</button></td>
- </tr>
- </tbody>
- <% /**I'm getting an error on this line on eclipse****/
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- %>
- </table>
Add Comment
Please, Sign In to add comment