Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <%@ page language="java" contentType="text/html"%>
- <%@ page import="java.text.*,java.util.*" %>
- <%--I commented this one because of I had compilation errors--%>
- <%--<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>--%>
- <%@page import="java.util.List"%>
- <%@page import="java.util.ArrayList"%>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <style>
- body {
- font-family: "Lato", sans-serif;
- }
- .sidenav {
- height: 100%;
- width: 160px;
- position: fixed;
- z-index: 1;
- top: 0;
- left: 0;
- background-color: #111;
- overflow-x: hidden;
- padding-top: 20px;
- }
- .topnav {
- background-color: #333;
- overflow: hidden;
- }
- /* Style the links inside the navigation bar */
- .topnav a {
- float: left;
- color: #f2f2f2;
- text-align: center;
- text-decoration: none;
- font-size: 17px;
- margin-left: 160px; /* Same as the width of the sidenav */
- padding: 5px 10px;
- }
- /* Change the color of links on hover */
- .topnav a:hover {
- background-color: #ddd;
- color: black;
- }
- /* Add a color to the active/current link */
- .topnav a.active {
- background-color: #4CAF50;
- color: white;
- }
- .sidenav a {
- padding: 6px 8px 6px 16px;
- text-decoration: none;
- font-size: 25px;
- color: #818181;
- display: block;
- }
- .sidenav a:hover {
- color: #f1f1f1;
- }
- .main {
- margin-left: 160px; /* Same as the width of the sidenav */
- font-size: 28px; /* Increased text to enable scrolling */
- padding: 0px 10px;
- }
- @media screen and (max-height: 450px) {
- .sidenav {padding-top: 15px;}
- .sidenav a {font-size: 18px;}
- }
- </style>
- </head>
- <body>
- <div class="sidenav">
- <a href="#about">About</a>
- <a href="#services">Services</a>
- <a href="#clients">Clients</a>
- <a href="#contact">Contact</a>
- <a href="#okk">${fileNames}</a>
- </div>
- <div class="topnav">
- <a class="active" href="#home">Home</a>
- <a href="#news">News</a>
- <a href="#contact">Contact</a>
- <a href="#about">About</a>
- </div>
- <div class = "main">
- <%--I commented these 3 lines, because I had a compilation error--%>
- <%--<c:forEach var="files" items="${fileNames}" >--%>
- <%--${files}--%>
- <%--</c:forEach>--%>
- </div>
- <%@ page import="java.io.*" %>
- <%@ page import="java.io.File" %>
- <table class="main" id="tableMain">
- <thead>
- <th scope="col">File Name</th>
- <%
- List<String> itemsArray = (ArrayList<String>) request.getAttribute("names");
- if(itemsArray!=null) {
- for (String name : itemsArray) {
- out.println("<tr>");
- out.println("<td>" + name + "</td>");
- out.println("</tr>");
- }
- }
- %></table>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
- <script>
- $('#tableMain').on('click', 'tr', function (e) {
- //alert("Damn");
- var tableData = $(this).children("td").map(function() {
- return $(this).text();
- }).get();
- var td=tableData[0];
- alert(td)
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement