1. Vadim Ne.
  2. internship

Commits

Vadim Ne.  committed b7ca383

Task 3. Intermediate commit. Various mprovements and cleanup in frontend.

  • Participants
  • Parent commits f0f4c88
  • Branches master

Comments (0)

Files changed (17)

File ngram-stats-web-view/src/main/java/servlets/ngram/ViewNgram.java

View file
 
 
     private void MakeASearch(final HttpServletRequest request, final String patternToFilter, final ViewNgramRest restParser, final boolean isSearch) throws SQLException {
-        int pageId = 1;
+        int pageId;
         WordsDatabaseReaderInterface dbreader = new WordsJdbcReader();
-        List<WordForNgramWithCount> listOfWordsForParticularNgram = null;
+        List<WordForNgramWithCount> listOfWordsForNgram = null;
         String pathPostConditions = "";
 
         final String ngramData = restParser.getNgramData();
         String orderFieldName = restParser.getOrderByFieldName();
         String order = restParser.getOrder();
 
+        int amountOfPages = (int) Math.ceil(dbreader.getAmountOfWordsWithCountersInDatabase(ngramData, patternToFilter) * 1.0 / 10);
+
+        if(pageId > amountOfPages) {
+            pageId = amountOfPages; //TODO question -- what to do with overheaded page id (currently if greater than amount, -- shows last available page)
+        }
+
         try {
             if (orderFieldName != null) {
                 if (order != null) {
-                    listOfWordsForParticularNgram = dbreader.getListOfTenWordsWithCounters(pageId - 1, ngramData, patternToFilter, orderFieldName, order);
+                    listOfWordsForNgram = dbreader.getListOfTenWordsWithCounters(pageId - 1, ngramData, patternToFilter, orderFieldName, order);
                     pathPostConditions = orderFieldName + "/" + order;
                 } else {
-                    listOfWordsForParticularNgram = dbreader.getListOfTenWordsWithCounters(pageId - 1, ngramData, patternToFilter, orderFieldName);
+                    listOfWordsForNgram = dbreader.getListOfTenWordsWithCounters(pageId - 1, ngramData, patternToFilter, orderFieldName);
                     pathPostConditions = orderFieldName;
                 }
             } else {
-                listOfWordsForParticularNgram = dbreader.getListOfTenWordsWithCounters(pageId - 1, ngramData, patternToFilter);
+                listOfWordsForNgram = dbreader.getListOfTenWordsWithCounters(pageId - 1, ngramData, patternToFilter);
             }
 
             final int finalPageId = pageId;
             request.setAttribute("sortInfo", new HashMap<String, String>() {{
-                put("currentPathInfo", "/ngram/" + restParser.getNgramData());
+                put("currentDirectoryPath", "/ngram/" + restParser.getNgramData());
                 put("page", String.valueOf(finalPageId));
                 put("sortByField", restParser.getOrderByFieldName());
                 put("order", restParser.getOrder());
                 if (isSearch) {
-                    put("additionalAttributes", "?query=" + patternToFilter);
+                    put("additionalParameters", "?query=" + patternToFilter);
                 }
             }});
         } catch (IllegalArgumentException e) {
-            listOfWordsForParticularNgram = dbreader.getListOfTenWordsWithCounters(0, ngramData, REGEX_PATTERN_TO_EXTRACT_ALL_WORDS);
+            listOfWordsForNgram = dbreader.getListOfTenWordsWithCounters(0, ngramData, REGEX_PATTERN_TO_EXTRACT_ALL_WORDS);
         } catch (Exception e) {
             e.printStackTrace();
         }
 
-        request.setAttribute("listOfWordsForParticularNgram", listOfWordsForParticularNgram);
+        request.setAttribute("listOfWordsForNgram", listOfWordsForNgram);
         request.setAttribute("ngramDataString", ngramData);
 
-        request.setAttribute("paginatorAmountOfPages", (int) Math.ceil(dbreader.getAmountOfWordsWithCountersInDatabase(ngramData, patternToFilter) * 1.0 / 10));
-        logger.info(" " + (int) Math.ceil(dbreader.getAmountOfWordsWithCountersInDatabase(ngramData, patternToFilter) * 1.0 / 10));
+        request.setAttribute("paginatorAmountOfPages", amountOfPages);
         request.setAttribute("paginatorCurrentPage", pageId);
-        request.setAttribute("paginatorPathPrePart", "/ngram/" + ngramData);
+        request.setAttribute("restCollectionPath", "/ngram/" + ngramData);
         if (isSearch) {
-            request.setAttribute("paginatorPathPostPart", pathPostConditions + "?query=" + patternToFilter);
+            request.setAttribute("restQueryParameters", pathPostConditions + "?query=" + patternToFilter);
         } else {
-            request.setAttribute("paginatorPathPostPart", pathPostConditions);
+            request.setAttribute("restQueryParameters", pathPostConditions);
         }
     }
 

File ngram-stats-web-view/src/main/java/servlets/ngrams/ViewNgrams.java

View file
 
             final int finalPageId = pageId;
             request.setAttribute("sortInfo", new HashMap<String, String>() {{
-                put("currentPathInfo", "/ngrams/view");
+                put("currentDirectoryPath", "/ngrams/view");
                 put("page", String.valueOf(finalPageId));
                 put("sortByField", restParser.getOrderByFieldName());
                 put("order", restParser.getOrder());
 
         request.setAttribute("paginatorAmountOfPages", (int) Math.ceil(dbreader.getAmountOfNgramsInDatabase() * 1.0 / 10));
         request.setAttribute("paginatorCurrentPage", pageId);
-        request.setAttribute("paginatorPathPrePart", "/ngrams/view");
-        request.setAttribute("paginatorPathPostPart", pathConditionsPart);
+        request.setAttribute("restCollectionPath", "/ngrams/view");
+        request.setAttribute("restQueryParameters", pathConditionsPart);
 
         return request.getRequestDispatcher(JSP_VIEW_TABLE_OF_NGRAMS_URL);
     }

File ngram-stats-web-view/src/main/webapp/WEB-INF/pages/about.jsp

View file
-
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<html>
+<%@page trimDirectiveWhitespaces="true" %>
+<!DOCTYPE html>
+<html lang="en">
 <head>
-    <title></title>
+    <%@ include file="/WEB-INF/pages/includes/common-head.jspf" %>
+    <title>About this viewer</title>
 </head>
 <body>
 
+<%@ include file="/WEB-INF/pages/includes/common-navbar.jspf" %>
+
+<div class="container" id="container">
+    <div class="span6 center-element">
+
+        <div class="text-center">
+            <h1>N-grams statistic web viewer</h1>
+            <p>By Vadim Ne. as a task of internship project for Grid Dynamics.</p>
+            <p>Kharkiv, autumn-winter 2013</p>
+        </div>
+    </div>
+</div>
+
+<%@ include file="/WEB-INF/pages/includes/common-tail.jspf" %>
 </body>
 </html>

File ngram-stats-web-view/src/main/webapp/WEB-INF/pages/includes/pagination.jspf

View file
 
 <%--
     The universal paginator component. To use this component you need to include it into page and pass through the model:
-    -- current page number
-    -- general (total) amount of pages
+    -- current page number (for 1 to n)
+    -- general (total) amount of pages (index is in diapason for 1 to n)
     -- links path divided into two parts (http://example.com/hello/world/example):
-    ---- previous part of path ("hello/world")
-    ---- past part of path ("example")
+    ---- rest colelction path ("hello/world")
+    ---- rest query parameters path ("example")
 --%>
 
 <jsp:useBean id="paginatorCurrentPage" scope="request" type="java.lang.Integer"/>
 <jsp:useBean id="paginatorAmountOfPages" scope="request" type="java.lang.Integer"/>
-<jsp:useBean id="paginatorPathPrePart" scope="request" type="java.lang.String"/>
-<jsp:useBean id="paginatorPathPostPart" scope="request" type="java.lang.String"/>
+<jsp:useBean id="restCollectionPath" scope="request" type="java.lang.String"/>
+<jsp:useBean id="restQueryParameters" scope="request" type="java.lang.String"/>
 
 <c:if test="${paginatorAmountOfPages > 1}">
-
     <div class="pagination pagination-mini pagination-centered">
         <ul>
-
                 <%--Display first page button--%>
             <c:choose>
                 <c:when test="${paginatorCurrentPage == 1}">
                 </c:when>
                 <c:otherwise>
                     <li>
-                        <a href="<c:url value="${paginatorPathPrePart}/1/${paginatorPathPostPart}"/>">
-                            First
-                        </a>
+                        <a href="<c:url value="${restCollectionPath}/1/${restQueryParameters}"/>"> First </a>
                     </li>
                 </c:otherwise>
             </c:choose>
                 <%-- Display Previous link except for the 1st page --%>
             <c:if test="${paginatorCurrentPage != 1}">
                 <li>
-                    <a href="<c:url value="${paginatorPathPrePart}/${paginatorCurrentPage - 1}/${paginatorPathPostPart}"/>">
+                    <a href="<c:url value="${restCollectionPath}/${paginatorCurrentPage - 1}/${restQueryParameters}"/>">
                         Previous
                     </a>
                 </li>
             </c:if>
-                <%-- This block outputs each page button -->
-                <%--<c:forEach begin="1" end="${amountOfPages}" var="i">--%>
-                <%--<c:choose>--%>
-                <%--<c:when test="${currentPage == i}">--%>
-                <%--<li class="active"><a href="#"> ${i} <span class="sr-only">(current page)</span></a></li>--%>
-                <%--</c:when>--%>
-                <%--<c:otherwise>--%>
-                <%--<li><a href="<c:url value="${paginatorPathPrePart}/${i}"/>"> ${i} </a></li>--%>
-                <%--</c:otherwise>--%>
-                <%--</c:choose>--%>
-                <%--</c:forEach>--%>
-
-                <%--Display Page numbers. The when condition does not display a link for the current page --%>
 
+                <%-- Display Page numbers. The when condition does not display a link for the current page --%>
                 <%-- TODO Try to optimize? --%>
             <c:choose>
                 <%-- Render this when page is 1..3 --%>
                                         <pagination:active-page current="${p}" total="${paginatorAmountOfPages}"/>
                                     </c:when>
                                     <c:otherwise>
-                                        <pagination:non-active-page paginatorPathPrePart="${paginatorPathPrePart}"
-                                                                    paginatorPathPostPart="${paginatorPathPostPart}"
+                                        <pagination:non-active-page paginatorPathPrePart="${restCollectionPath}"
+                                                                    paginatorPathPostPart="${restQueryParameters}"
                                                                     p="${p}"/>
                                     </c:otherwise>
                                 </c:choose>
                             </c:forEach>
                             <li class="disabled"><a href="#">...</a></li>
                         </c:when>
+
+                        <%-- If we have only two pages --%>
                         <c:otherwise>
                             <c:forEach begin="1" end="${paginatorCurrentPage}" var="p">
                                 <c:choose>
                                         <pagination:active-page current="${p}" total="${paginatorAmountOfPages}"/>
                                     </c:when>
                                     <c:otherwise>
-                                        <pagination:non-active-page paginatorPathPrePart="${paginatorPathPrePart}"
-                                                                    paginatorPathPostPart="${paginatorPathPostPart}"
+                                        <pagination:non-active-page paginatorPathPrePart="${restCollectionPath}"
+                                                                    paginatorPathPostPart="${restQueryParameters}"
                                                                     p="${p}"/>
                                     </c:otherwise>
                                 </c:choose>
                             </c:when>
                             <c:otherwise>
                                 <li>
-                                    <pagination:non-active-page paginatorPathPrePart="${paginatorPathPrePart}"
-                                                                paginatorPathPostPart="${paginatorPathPostPart}"
+                                    <pagination:non-active-page paginatorPathPrePart="${restCollectionPath}"
+                                                                paginatorPathPostPart="${restQueryParameters}"
                                                                 p="${p}"/>
                                 </li>
                             </c:otherwise>
                                 <pagination:active-page current="${p}" total="${paginatorAmountOfPages}"/>
                             </c:when>
                             <c:otherwise>
-                                <pagination:non-active-page paginatorPathPrePart="${paginatorPathPrePart}"
-                                                            paginatorPathPostPart="${paginatorPathPostPart}"
+                                <pagination:non-active-page paginatorPathPrePart="${restCollectionPath}"
+                                                            paginatorPathPostPart="${restQueryParameters}"
                                                             p="${p}"/>
                             </c:otherwise>
                         </c:choose>
                 <%-- Display Next link --%>
             <c:if test="${paginatorCurrentPage != paginatorAmountOfPages}">
                 <li>
-                    <a href="<c:url value="${paginatorPathPrePart}/${paginatorCurrentPage + 1}/${paginatorPathPostPart}"/>">
+                    <a href="<c:url value="${restCollectionPath}/${paginatorCurrentPage + 1}/${restQueryParameters}"/>">
                         Next </a>
                 </li>
             </c:if>
                 </c:when>
                 <c:otherwise>
                     <li>
-                        <a href="<c:url value="${paginatorPathPrePart}/${paginatorAmountOfPages}/${paginatorPathPostPart}"/>">
+                        <a href="<c:url value="${restCollectionPath}/${paginatorAmountOfPages}/${restQueryParameters}"/>">
                             Last </a>
                     </li>
                 </c:otherwise>

File ngram-stats-web-view/src/main/webapp/WEB-INF/pages/ngram/search-result.jsp

View file
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@page trimDirectiveWhitespaces="true" %>
+<%@ page trimDirectiveWhitespaces="true" %>
 
-<%@ taglib prefix="own" uri="/WEB-INF/tags/pagination-tags.tld" %>    <%-- TODO --%>
+<%@ taglib prefix="buttons" uri="/WEB-INF/tags/anchor-buttons.tld" %>
 
 <jsp:useBean id="sortInfo" scope="request" type="java.util.Map"/>
+<jsp:useBean id="listOfWordsForNgram" scope="request" type="java.util.List<dao.entities.logical.WordForNgramWithCount>"/> <%-- TODO check on empty!!--%>
 <jsp:useBean id="ngramDataString" scope="request" type="java.lang.String"/>
 <jsp:useBean id="searchWordPatternDataString" scope="request" type="java.lang.String"/>
-<jsp:useBean id="listOfWordsForParticularNgram" scope="request" type="java.util.List<dao.entities.logical.WordForNgramWithCount>"/>
 
 <!DOCTYPE html>
 <html lang="en">
 <head>
     <%@ include file="/WEB-INF/pages/includes/common-head.jspf" %>
-    <title>View words in which n-gram ${ngramDataString} is occurring.</title>
+    <title>View words for n-gram '${ngramDataString}'</title>
 </head>
 <body>
 
 
 <div class="container" id="container">
     <div class="span6 center-element">
-        <h1>N-gram: '${ngramDataString}'</h1> <h1>Word pattern: '${searchWordPatternDataString}'</h1>
+        <h1>Search result for n-gram: '${ngramDataString}'</h1> <h1>Word pattern: '${searchWordPatternDataString}'</h1>
         <br/>
         <%@ include file="/WEB-INF/pages/includes/search.jspf" %>
         <br/>
 
         <c:choose>
-            <c:when test="${listOfWordsForParticularNgram != null}">
+            <c:when test="${listOfWordsForNgram != null}">
                 <table id="content-table" class="table table-bordered table-striped data-table sort display">
                     <thead>
                     <tr>
-                        <th class="sorting">Words <own:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="word"/></th>
-                        <th class="sorting">N-Grams count <own:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="count"/></th>
+                        <th class="sorting">Words <buttons:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="word"/></th>
+                        <th class="sorting">N-Grams count <buttons:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="count"/></th>
                     </tr>
                     </thead>
                     <tbody>
-                    <c:forEach items="${listOfWordsForParticularNgram}" var="word">
+                    <c:forEach items="${listOfWordsForNgram}" var="word">
                         <tr>
                             <td>
                                 <c:out value="${word.word}"/>
                     </c:forEach>
                     </tbody>
                 </table>
-
+                <br/>
                 <%@ include file="/WEB-INF/pages/includes/pagination.jspf" %>
             </c:when>
             <c:otherwise>
                 <h1>Nothing found. You can retry search</h1>
             </c:otherwise>
         </c:choose>
-
-
     </div>
 
 </div>

File ngram-stats-web-view/src/main/webapp/WEB-INF/pages/ngram/view.jsp

View file
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@page trimDirectiveWhitespaces="true" %>
+<%@ page trimDirectiveWhitespaces="true" %>
 
-<%@ taglib prefix="own" uri="/WEB-INF/tags/pagination-tags.tld" %>    <%-- TODO --%>
+<%@ taglib prefix="buttons" uri="/WEB-INF/tags/anchor-buttons.tld" %>
 
 <jsp:useBean id="sortInfo" scope="request" type="java.util.Map"/>
+<jsp:useBean id="listOfWordsForNgram" scope="request" type="java.util.List<dao.entities.logical.WordForNgramWithCount>"/>
 <jsp:useBean id="ngramDataString" scope="request" type="java.lang.String"/>
 
 <!DOCTYPE html>
 <html lang="en">
 <head>
     <%@ include file="/WEB-INF/pages/includes/common-head.jspf" %>
-    <title>View words in which n-gram ${ngramDataString} is occurring.</title>
+    <title>View words for n-gram '${ngramDataString}'</title>
 </head>
 <body>
 
         <table id="content-table" class="table table-bordered table-striped data-table sort display">
             <thead>
             <tr>
-                <th class="sorting">Words <own:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="word"/></th>
-                <th class="sorting">N-Grams count <own:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="count"/></th>
+                <th class="sorting">Words <buttons:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="word"/></th>
+                <th class="sorting">N-Grams count <buttons:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="count"/></th>
             </tr>
             </thead>
             <tbody>
-            <jsp:useBean id="listOfWordsForParticularNgram" scope="request" type="java.util.List<dao.entities.logical.WordForNgramWithCount>"/>
-            <c:forEach items="${listOfWordsForParticularNgram}" var="word">
+
+            <c:forEach items="${listOfWordsForNgram}" var="word"> <%--TODO check for empty--%>
                 <tr>
-                    <td>
-                        <c:out value="${word.word}"/>
-                    </td>
-                    <td>
-                        <c:out value="${word.count}"/>
-                    </td>
+                    <td><c:out value="${word.word}"/></td>
+                    <td><c:out value="${word.count}"/></td>
                 </tr>
             </c:forEach>
+
             </tbody>
         </table>
-
+        <br/>
         <%@ include file="/WEB-INF/pages/includes/pagination.jspf" %>
     </div>
 

File ngram-stats-web-view/src/main/webapp/WEB-INF/pages/ngrams/search-result.jsp

View file
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@page trimDirectiveWhitespaces="true" %>
+<%@ page trimDirectiveWhitespaces="true" %>
 
 <%--
     The search result component. To use this component you need to include it into page and pass through the model:
     -- searchResult Map
 
     This map contains <String, Ngram> values and it may contain "ngram" key.
-    This key can contain object of Ngram type, if backend found appropriate N-gram by its data field
+    This key can contain object of Ngram type, if backend found appropriate n-ggram by its data field
     or null, if nothing found.
 --%>
 
 <html lang="en">
 <head>
     <%@ include file="/WEB-INF/pages/includes/common-head.jspf" %>
-    <title>Search results for ${param.query}.</title>
+    <title>Search results for ${param.query}</title>
 </head>
 <body>
 
 
 <div class="container" id="container">
     <div class="span6 center-element">
+        <h1>Search results for '${param.query}'</h1>
         <br/>
         <%@ include file="/WEB-INF/pages/includes/search.jspf" %>
         <br/>
                 </c:when>
                 <c:otherwise>
                     <h1>N-gram: '<a href="<c:url value="/ngram/${searchResult.ngram.data}"/>">${searchResult.ngram.data}</a>'</h1>
-
+                    <br/>
                     <p>Repeats <strong>${searchResult.ngram.count}</strong> times in dataset.</p>
                 </c:otherwise>
             </c:choose>
             <br/>
             <br/>
-
             <p class="text-center">
-                <a href="<c:url value="/ngrams/view"/>" class="btn btn-primary btn-large">
-                    <i class="icon-white icon-align-justify"></i> Go back to N-grams view</a>
+                <a href="<c:url value="${pageContext.request.contextPath}/ngrams/view"/>" class="btn btn-primary btn-large">
+                    <i class="icon-white icon-align-justify"></i> Go back to n-grams list</a>
             </p>
         </div>
     </div>

File ngram-stats-web-view/src/main/webapp/WEB-INF/pages/ngrams/view.jsp

View file
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@page trimDirectiveWhitespaces="true" %>
+<%@ page trimDirectiveWhitespaces="true" %>
 
-<%@ taglib prefix="own" uri="/WEB-INF/tags/pagination-tags.tld" %>
+<%@ taglib prefix="buttons" uri="/WEB-INF/tags/anchor-buttons.tld" %>
 
 <jsp:useBean id="sortInfo" scope="request" type="java.util.Map"/>
+<jsp:useBean id="listOfNgrams" scope="request" type="java.util.List<dao.entities.dbTables.Ngram>"/>
 
 <!DOCTYPE html>
 <html lang="en">
 <head>
     <%@ include file="/WEB-INF/pages/includes/common-head.jspf" %>
-    <title>View list of ngrams.</title>
+    <title>View list of n-grams</title>
 </head>
 <body>
 
 
 <div class="container" id="container">
     <div class="span6 center-element">
-        <h1>List of all N-grams</h1>
+        <h1>List of all n-grams</h1>
         <br/>
         <%@ include file="/WEB-INF/pages/includes/search.jspf" %>
         <br/>
         <table id="content-table" class="table table-bordered table-striped data-table sort display">
             <thead>
             <tr>
-                <th class="sorting">N-Gram <own:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="name"/></th>
-                <th class="sorting">Count <own:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="count"/></th>
+                <th class="sorting">N-Gram <buttons:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="name"/></th>
+                <th class="sorting">Count <buttons:table-sort-icon-generator sortInfo="${sortInfo}" currentFieldName="count"/></th>
             </tr>
             </thead>
             <tbody>
-            <jsp:useBean id="listOfNgrams" scope="request" type="java.util.List<dao.entities.dbTables.Ngram>"/>
-            <c:forEach items="${listOfNgrams}" var="ngram">
+
+            <c:forEach items="${listOfNgrams}" var="ngramItem"> <%--TODO check for empty--%>
                 <tr>
-                    <td>
-                        <a href="<c:url value="/ngram/${ngram.data}"/>"><c:out value="${ngram.data}"/></a>
-                    </td>
-                    <td>
-                        <c:out value="${ngram.count}"/>
-                    </td>
+                    <td><a href="<c:url value="/ngram/${ngramItem.data}"/>"><c:out value="${ngramItem.data}"/></a></td>
+                    <td><c:out value="${ngramItem.count}"/></td>
                 </tr>
             </c:forEach>
+
             </tbody>
         </table>
-
+        <br/>
         <%@ include file="/WEB-INF/pages/includes/pagination.jspf" %>
     </div>
 

File ngram-stats-web-view/src/main/webapp/WEB-INF/tags/anchor-buttons.tld

View file
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<taglib xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+        version="2.1">
+
+    <tlib-version>1.0</tlib-version>
+    <short-name>anchor-buttons</short-name>
+
+    <tag-file>
+        <name>table-sort-icon-generator</name>
+        <path>/WEB-INF/tags/anchor-buttons/table-sort-icon-generator.tag</path>
+    </tag-file>
+</taglib>

File ngram-stats-web-view/src/main/webapp/WEB-INF/tags/anchor-buttons/table-sort-icon-generator.tag

View file
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ tag trimDirectiveWhitespaces="true" %>
+
+<%--This tag generates anchor (link) and an icon to refer to appropriate tabe sorting url.
+    -- sortInfo bean refers to Map<String, String> which contains
+        ---- currentDirectoryPath -- contain current path info without last slash (e.g. for http://example.com/one/two/, this value may be "/one/two")
+        ---- page -- page to get after the sort will be applied
+        ---- sortByField -- name of the field to sort by
+        ---- order -- order of sort [asc|desc]
+        ---- additionalParameters -- parameters that will be added to the end of generated URL
+    -- currentFieldName String that names the field where this tag inserted.
+--%>
+
+<%@ attribute name="sortInfo" required="true" type="java.util.Map" %>
+<%@ attribute name="currentFieldName" required="true" type="java.lang.String" %>
+
+<c:choose>
+    <c:when test="${sortInfo.sortByField == currentFieldName}">
+        <c:if test="${sortInfo.order == 'asc'}"> <%--From asc switch to default sort method.--%>
+            <a href="<c:out value="${sortInfo.currentDirectoryPath}/${sortInfo.page}/${sortInfo.additionalParameters}"/>">
+                <i class="icon-chevron-up element-glow"></i>
+            </a>
+        </c:if>
+        <c:if test="${sortInfo.order == 'desc'}"> <%--From desc switch to asc sort method.--%>
+            <a href="<c:out value="${sortInfo.currentDirectoryPath}/${sortInfo.page}/${currentFieldName}/asc/${sortInfo.additionalParameters}"/>">
+                <i class="icon-chevron-down element-glow"></i>
+            </a>
+        </c:if>
+    </c:when>
+    <c:otherwise> <%--From default switch to desc sort method.--%>
+        <a href="<c:out value="${sortInfo.currentDirectoryPath}/${sortInfo.page}/${currentFieldName}/desc/${sortInfo.additionalParameters}"/>">
+            <i class="icon-list element-glow"></i>
+        </a>
+    </c:otherwise>
+</c:choose>

File ngram-stats-web-view/src/main/webapp/WEB-INF/tags/pagination-current-active-page.tag

-<%@ tag trimDirectiveWhitespaces="true" %>
-
-<%@ attribute name="current" required="true" type="java.lang.Integer" %>
-<%@ attribute name="total" required="true" type="java.lang.Integer" %>
-
-<li class="active"><a href="#"> ${current} / ${total} </a></li>

File ngram-stats-web-view/src/main/webapp/WEB-INF/tags/pagination-include/pagination-current-active-page.tag

View file
+<%@ tag trimDirectiveWhitespaces="true" %>
+
+<%@ attribute name="current" required="true" type="java.lang.Integer" %>
+<%@ attribute name="total" required="true" type="java.lang.Integer" %>
+
+<li class="active"><a href="#"> ${current} / ${total} </a></li>

File ngram-stats-web-view/src/main/webapp/WEB-INF/tags/pagination-include/pagination-non-active-page.tag

View file
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ tag trimDirectiveWhitespaces="true" %>
+
+<%@ attribute name="paginatorPathPrePart" required="true" type="java.lang.String" %>
+<%@ attribute name="paginatorPathPostPart" required="true" type="java.lang.String" %>
+<%@ attribute name="p" required="true" type="java.lang.Integer" %>
+
+<li><a href="<c:url value="${paginatorPathPrePart}/${p}/${paginatorPathPostPart}"/>"> ${p} </a></li>

File ngram-stats-web-view/src/main/webapp/WEB-INF/tags/pagination-non-active-page.tag

-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@ tag trimDirectiveWhitespaces="true" %>
-
-<%@ attribute name="paginatorPathPrePart" required="true" type="java.lang.String" %>
-<%@ attribute name="paginatorPathPostPart" required="true" type="java.lang.String" %>
-<%@ attribute name="p" required="true" type="java.lang.Integer" %>
-
-<li><a href="<c:url value="${paginatorPathPrePart}/${p}/${paginatorPathPostPart}"/>"> ${p} </a></li>

File ngram-stats-web-view/src/main/webapp/WEB-INF/tags/pagination-tags.tld

View file
 
     <tag-file>
         <name>active-page</name>
-        <path>/WEB-INF/tags/pagination-current-active-page.tag</path>
+        <path>/WEB-INF/tags/pagination-include/pagination-current-active-page.tag</path>
     </tag-file>
 
     <tag-file>
         <name>non-active-page</name>
-        <path>/WEB-INF/tags/pagination-non-active-page.tag</path>
-    </tag-file>
-
-    <tag-file>
-        <name>table-sort-icon-generator</name>
-        <path>/WEB-INF/tags/table-sort-icon-generator.tag</path>
+        <path>/WEB-INF/tags/pagination-include/pagination-non-active-page.tag</path>
     </tag-file>
 </taglib>

File ngram-stats-web-view/src/main/webapp/WEB-INF/tags/table-sort-icon-generator.tag

-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@ tag trimDirectiveWhitespaces="true" %>
-
-<%--This tag generates anchor (link) and an icon to refer to appropriate tabe sorting url.
-    -- sortInfo bean refers to Map<String, String> which contains
-        ---- currentPathInfo -- contain current path info without last slash (e.g. for http://example.com/one/two/, this value may be "/one/two")
-        ---- page -- page to get after the sort will be applied
-        ---- sortByField -- name of the field to sort by
-        ---- order -- order of sort [asc|desc]
-    -- currentFieldName String that names the field where this tag inserted.
---%>
-
-<%@ attribute name="sortInfo" required="true" type="java.util.Map" %>
-<%@ attribute name="currentFieldName" required="true" type="java.lang.String" %>
-
-<c:choose>
-    <c:when test="${sortInfo.sortByField == currentFieldName}">
-        <c:if test="${sortInfo.order == 'asc'}"> <%--From asc switch to default sort method.--%>
-            <a href="<c:out value="${sortInfo.currentPathInfo}/${sortInfo.page}/${sortInfo.additionalAttributes}"/>">
-                <i class="icon-chevron-up element-glow"></i>
-            </a>
-        </c:if>
-        <c:if test="${sortInfo.order == 'desc'}"> <%--From desc switch to asc sort method.--%>
-            <a href="<c:out value="${sortInfo.currentPathInfo}/${sortInfo.page}/${currentFieldName}/asc/${sortInfo.additionalAttributes}"/>">
-                <i class="icon-chevron-down element-glow"></i>
-            </a>
-        </c:if>
-    </c:when>
-    <c:otherwise> <%--From default switch to desc sort method.--%>
-        <a href="<c:out value="${sortInfo.currentPathInfo}/${sortInfo.page}/${currentFieldName}/desc/${sortInfo.additionalAttributes}"/>">
-            <i class="icon-list element-glow"></i>
-        </a>
-    </c:otherwise>
-</c:choose>

File ngram-stats-web-view/src/main/webapp/WEB-INF/web.xml

View file
         <param-value>/log4j.properties</param-value>
     </context-param>
 
-    <display-name>Ngrams stats web viewer.</display-name>
+    <display-name>N-grams stats web viewer</display-name>
     <servlet>
         <servlet-name>Homepage Servlet</servlet-name>
         <servlet-class>servlets.HomepageServlet</servlet-class>
     </servlet-mapping>
 
     <servlet>
-        <servlet-name>Ngrams View Servlet</servlet-name>
+        <servlet-name>N-grams View Servlet</servlet-name>
         <servlet-class>servlets.ngrams.ViewNgrams</servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>
     <servlet-mapping>
-        <servlet-name>Ngrams View Servlet</servlet-name>
+        <servlet-name>N-grams View Servlet</servlet-name>
         <url-pattern>/ngrams/view/*</url-pattern>
     </servlet-mapping>
 
     <servlet>
-        <servlet-name>Single Ngram View Servlet</servlet-name>
+        <servlet-name>Single N-gram View Servlet</servlet-name>
         <servlet-class>servlets.ngram.ViewNgram</servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>
     <servlet-mapping>
-        <servlet-name>Single Ngram View Servlet</servlet-name>
+        <servlet-name>Single N-gram View Servlet</servlet-name>
         <url-pattern>/ngram/*</url-pattern>
     </servlet-mapping>
 
     <servlet>
-        <servlet-name>About page</servlet-name>
-        <jsp-file>/pages/about.jsp</jsp-file>
+        <servlet-name>About Page</servlet-name>
+        <jsp-file>/WEB-INF/pages/about.jsp</jsp-file>
     </servlet>
     <servlet-mapping>
-        <servlet-name>About page</servlet-name>
+        <servlet-name>About Page</servlet-name>
         <url-pattern>/about/*</url-pattern>
     </servlet-mapping>