JSP více modulární – rozdělení na více souborů
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 01 Mar 2009 17:16:53 +0100
changeset 41d41dc2f3380d
parent 40 fd29fd5a8e29
child 42 63d0f3ef8ca9
JSP více modulární – rozdělení na více souborů
java/HrisniciSpameri/web/filtr.jspx
java/HrisniciSpameri/web/graf.jspx
java/HrisniciSpameri/web/index.jsp
java/HrisniciSpameri/web/seznamCilu.jspx
java/HrisniciSpameri/web/souhrn.jspx
java/HrisniciSpameri/web/tabulkaSouhrnu.jspx
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/HrisniciSpameri/web/filtr.jspx	Sun Mar 01 17:16:53 2009 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
     1.6 +          xmlns:c="http://java.sun.com/jsp/jstl/core"
     1.7 +          xmlns:f="http://java.sun.com/jsp/jstl/functions"
     1.8 +          version="2.0">
     1.9 +
    1.10 +    <form action="#" method="get">
    1.11 +        <fieldset>
    1.12 +            <label>Začátek: <input name="zacatek" type="text" value="${denniSouhrn.zacatek}"/></label><br/>
    1.13 +            <label title="Pokud konec nezadáte, zobrazí se souhrn za jeden den – začátek">Konec: <input name="konec" type="text" value="${denniSouhrn.konec}"/></label><br/>
    1.14 +            <label>Cíl: <select name="cil">
    1.15 +                    <option value="0">Všechny cíle</option>
    1.16 +                    <c:forEach var="c" items="${denniSouhrn.seznamCilu}">
    1.17 +                        <c:choose>
    1.18 +                            <c:when test="${c.id == denniSouhrn.cil}">
    1.19 +                                <option value="${c.id}" selected="selected"><c:out value="${c.nazev}"/></option>
    1.20 +                            </c:when>
    1.21 +                            <c:otherwise>
    1.22 +                                <option value="${c.id}"><c:out value="${c.nazev}"/></option>
    1.23 +                            </c:otherwise>
    1.24 +                        </c:choose>
    1.25 +                    </c:forEach>
    1.26 +            </select></label><br/>
    1.27 +            <input name="graf" type="hidden" value="${param.graf}"/>
    1.28 +            <button>Zobrazit</button>
    1.29 +        </fieldset>
    1.30 +    </form>
    1.31 +</jsp:root>
    1.32 \ No newline at end of file
     2.1 --- a/java/HrisniciSpameri/web/graf.jspx	Sun Mar 01 13:04:10 2009 +0100
     2.2 +++ b/java/HrisniciSpameri/web/graf.jspx	Sun Mar 01 17:16:53 2009 +0100
     2.3 @@ -5,8 +5,6 @@
     2.4            xmlns:cewolf="http://cewolf.sourceforge.net/taglib/cewolf.tld"
     2.5            version="2.0">
     2.6  
     2.7 -    <h2>Graf</h2>
     2.8 -
     2.9      <jsp:useBean id="casovyGrafUtoku" class="cz.frantovo.hrisniciSpameri.grafy.CasovyGrafUtoku" />
    2.10  
    2.11  
     3.1 --- a/java/HrisniciSpameri/web/index.jsp	Sun Mar 01 13:04:10 2009 +0100
     3.2 +++ b/java/HrisniciSpameri/web/index.jsp	Sun Mar 01 17:16:53 2009 +0100
     3.3 @@ -15,11 +15,7 @@
     3.4          <h1>Hříšníci spameři</h1>
     3.5  
     3.6          <jsp:include page="souhrn.jspx"/>
     3.7 -        <c:choose>
     3.8 -            <c:when test="${param.graf == 'ano'}">
     3.9 -                <jsp:include page="graf.jspx"/>
    3.10 -            </c:when>
    3.11 -        </c:choose>
    3.12 +        
    3.13  
    3.14          <div id="licence">Program je vydán pod licencí: <a href="licence.txt">GNU Affero GPL</a>. A zdrojové kódy jsou ke stažení: <a href="HrisniciSpameri-src.zip">HrisniciSpameri-src.zip</a><a href="HrisniciSpameri-src.zip.SHA-512">.</a></div>
    3.15  
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/java/HrisniciSpameri/web/seznamCilu.jspx	Sun Mar 01 17:16:53 2009 +0100
     4.3 @@ -0,0 +1,24 @@
     4.4 +<?xml version="1.0" encoding="UTF-8"?>
     4.5 +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
     4.6 +          xmlns:c="http://java.sun.com/jsp/jstl/core"
     4.7 +          xmlns:f="http://java.sun.com/jsp/jstl/functions"
     4.8 +          version="2.0">
     4.9 +
    4.10 +    <p><a onclick="JavaScript: zobrazNeboSkryj('seznamCilu')" href="#">Seznam cílů</a></p>
    4.11 +    <div id="seznamCilu">
    4.12 +        <ul>
    4.13 +            <c:forEach var="c" items="${denniSouhrn.seznamCilu}">
    4.14 +                <li>
    4.15 +                    <c:choose>
    4.16 +                        <c:when test="${c.url == null}">
    4.17 +                            <c:out value="${c.nazev}"/>
    4.18 +                        </c:when>
    4.19 +                        <c:otherwise>
    4.20 +                            <a href="${f:escapeXml(c.url)}"><c:out value="${c.nazev}"/></a>
    4.21 +                        </c:otherwise>
    4.22 +                    </c:choose>
    4.23 +                </li>
    4.24 +            </c:forEach>
    4.25 +        </ul>
    4.26 +    </div>
    4.27 +</jsp:root>
    4.28 \ No newline at end of file
     5.1 --- a/java/HrisniciSpameri/web/souhrn.jspx	Sun Mar 01 13:04:10 2009 +0100
     5.2 +++ b/java/HrisniciSpameri/web/souhrn.jspx	Sun Mar 01 17:16:53 2009 +0100
     5.3 @@ -4,83 +4,23 @@
     5.4            xmlns:f="http://java.sun.com/jsp/jstl/functions"
     5.5            version="2.0">
     5.6  
     5.7 -    <jsp:useBean id="denniSouhrn" class="cz.frantovo.hrisniciSpameri.DenniSouhrn" scope="page"/>
     5.8 +    <jsp:useBean id="denniSouhrn" class="cz.frantovo.hrisniciSpameri.DenniSouhrn" scope="request"/>
     5.9      <jsp:setProperty name="denniSouhrn" property="zacatekString" value="${param.zacatek}"/>
    5.10      <jsp:setProperty name="denniSouhrn" property="konecString" value="${param.konec}"/>
    5.11      <jsp:setProperty name="denniSouhrn" property="cilString" value="${param.cil}"/>
    5.12  
    5.13  
    5.14 -    <p><a onclick="JavaScript: zobrazNeboSkryj('seznamCilu')" href="#">Seznam cílů</a></p>
    5.15 -    <div id="seznamCilu">
    5.16 -        <ul>
    5.17 -            <c:forEach var="c" items="${denniSouhrn.seznamCilu}">
    5.18 -                <li>
    5.19 -                    <c:choose>
    5.20 -                        <c:when test="${c.url == null}">
    5.21 -                            <c:out value="${c.nazev}"/>
    5.22 -                        </c:when>
    5.23 -                        <c:otherwise>
    5.24 -                            <a href="${f:escapeXml(c.url)}"><c:out value="${c.nazev}"/></a>
    5.25 -                        </c:otherwise>
    5.26 -                    </c:choose>
    5.27 -                </li>
    5.28 -            </c:forEach>
    5.29 -        </ul>
    5.30 -    </div>
    5.31 +    <jsp:include page="seznamCilu.jspx"/>
    5.32  
    5.33 +    <h2>Filtr</h2>
    5.34 +    <jsp:include page="filtr.jspx"/>
    5.35  
    5.36      <h2>Denní souhrn</h2>
    5.37 -    <form action="#" method="get">
    5.38 -        <fieldset>
    5.39 -            <label>Začátek: <input name="zacatek" type="text" value="${denniSouhrn.zacatek}"/></label><br/>
    5.40 -            <label title="Pokud konec nezadáte, zobrazí se souhrn za jeden den – začátek">Konec: <input name="konec" type="text" value="${denniSouhrn.konec}"/></label><br/>
    5.41 -            <label>Cíl: <select name="cil">
    5.42 -                    <option value="0">Všechny cíle</option>
    5.43 -                    <c:forEach var="c" items="${denniSouhrn.seznamCilu}">
    5.44 -                        <c:choose>
    5.45 -                            <c:when test="${c.id == denniSouhrn.cil}">
    5.46 -                                <option value="${c.id}" selected="selected"><c:out value="${c.nazev}"/></option>
    5.47 -                            </c:when>
    5.48 -                            <c:otherwise>
    5.49 -                                <option value="${c.id}"><c:out value="${c.nazev}"/></option>
    5.50 -                            </c:otherwise>
    5.51 -                        </c:choose>
    5.52 -                    </c:forEach>
    5.53 -            </select></label><br/>
    5.54 -            <input name="graf" type="hidden" value="${param.graf}"/>
    5.55 -            <button>Zobrazit</button>
    5.56 -        </fieldset>
    5.57 -    </form>
    5.58 +    <jsp:include page="tabulkaSouhrnu.jspx"/>
    5.59  
    5.60 -    <table class="sortable" id="seznamHrisniku">
    5.61 -        <thead>
    5.62 -            <tr>
    5.63 -                <td title="Zaznamenaná IP">IP adresa</td>
    5.64 -                <td title="Dodatečně přeložené jméno">Doména</td>
    5.65 -                <td title="Kolikrát spamoval">Počet pokusů</td>
    5.66 -                <td title="Den (posledního) pokusu">Datum</td>
    5.67 -                <td title="Kde spamoval">Cíl útoku</td>
    5.68 -            </tr>
    5.69 -        </thead>
    5.70 -        <tbody>
    5.71 -            <c:forEach var="s" items="${denniSouhrn.souhrn}">
    5.72 -                <tr>
    5.73 -                    <td><c:out value="${s.adresa.ip}"/></td>
    5.74 -                    <td><c:out value="${s.adresa.domena}"/></td>
    5.75 -                    <td class="cislo"><c:out value="${s.pocet}"/></td>
    5.76 -                    <td><c:out value="${s.den}"/></td>
    5.77 -                    <td><c:choose>
    5.78 -                            <c:when test="${s.cil.url == null}">
    5.79 -                                <c:out value="${s.cil.nazev}"/>
    5.80 -                            </c:when>
    5.81 -                            <c:otherwise>
    5.82 -                                <a href="${f:escapeXml(s.cil.url)}"><c:out value="${s.cil.nazev}"/></a>
    5.83 -                            </c:otherwise>
    5.84 -                        </c:choose>
    5.85 -                    </td>
    5.86 -                </tr>
    5.87 -            </c:forEach>
    5.88 -        </tbody>
    5.89 -    </table>   
    5.90 +    <c:if test="${param.graf == 'ano'}">
    5.91 +        <h2>Graf</h2>
    5.92 +        <jsp:include page="graf.jspx"/>
    5.93 +    </c:if>
    5.94  
    5.95  </jsp:root>
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/java/HrisniciSpameri/web/tabulkaSouhrnu.jspx	Sun Mar 01 17:16:53 2009 +0100
     6.3 @@ -0,0 +1,37 @@
     6.4 +<?xml version="1.0" encoding="UTF-8"?>
     6.5 +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
     6.6 +          xmlns:c="http://java.sun.com/jsp/jstl/core"
     6.7 +          xmlns:f="http://java.sun.com/jsp/jstl/functions"
     6.8 +          version="2.0">
     6.9 +
    6.10 +    <table class="sortable" id="seznamHrisniku">
    6.11 +        <thead>
    6.12 +            <tr>
    6.13 +                <td title="Zaznamenaná IP">IP adresa</td>
    6.14 +                <td title="Dodatečně přeložené jméno">Doména</td>
    6.15 +                <td title="Kolikrát spamoval">Počet pokusů</td>
    6.16 +                <td title="Den (posledního) pokusu">Datum</td>
    6.17 +                <td title="Kde spamoval">Cíl útoku</td>
    6.18 +            </tr>
    6.19 +        </thead>
    6.20 +        <tbody>
    6.21 +            <c:forEach var="s" items="${denniSouhrn.souhrn}">
    6.22 +                <tr>
    6.23 +                    <td><c:out value="${s.adresa.ip}"/></td>
    6.24 +                    <td><c:out value="${s.adresa.domena}"/></td>
    6.25 +                    <td class="cislo"><c:out value="${s.pocet}"/></td>
    6.26 +                    <td><c:out value="${s.den}"/></td>
    6.27 +                    <td><c:choose>
    6.28 +                            <c:when test="${s.cil.url == null}">
    6.29 +                                <c:out value="${s.cil.nazev}"/>
    6.30 +                            </c:when>
    6.31 +                            <c:otherwise>
    6.32 +                                <a href="${f:escapeXml(s.cil.url)}"><c:out value="${s.cil.nazev}"/></a>
    6.33 +                            </c:otherwise>
    6.34 +                        </c:choose>
    6.35 +                    </td>
    6.36 +                </tr>
    6.37 +            </c:forEach>
    6.38 +        </tbody>
    6.39 +    </table>   
    6.40 +</jsp:root>
    6.41 \ No newline at end of file