Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
- <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
- <%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
- <!DOCTYPE html>
- <c:if test="${param.locale != null}">
- <c:set var="locale" value="${param.locale}" scope="session"/>
- </c:if>
- <fmt:setLocale value="${locale}" scope="application" />
- <fmt:setBundle basename="messages" scope="application" />
- <sql:setDataSource
- driver="org.apache.derby.jdbc.EmbeddedDriver"
- user=""
- password=""
- url="jdbc:derby:p:/.netbeans-derby/kontakty"
- var="db"
- scope="application"
- />
- <sql:query var="osoby" dataSource="${db}">
- select * from osoba order by prijmeni, jmeno
- </sql:query>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title><fmt:message key="index.title" /></title>
- <link rel="stylesheet" href="styly.css" type="text/css">
- </head>
- <body>
- <h1><fmt:message key="index.title" /></h1>
- <form action="index.jsp" method="POST">
- <fmt:message key="index.lang" />
- <select name="locale">
- <option>cs_CZ</option>
- <option>en_US</option>
- <option>de_DE</option>
- <option>sk_SK</option>
- </select>
- <input type="submit" value="<fmt:message key="index.change" />" />
- </form>
- <table border="0" cellpadding="3" cellspacing="0">
- <thead>
- <tr>
- <th width="100" align="left"><fmt:message key="index.lastname" /></th>
- <th width="100" align="left"><fmt:message key="index.firstname" /></th>
- <th width="200" align="left"><fmt:message key="index.address" /></th>
- <th width="50" align="left"><fmt:message key="index.operation" /></th>
- </tr>
- </thead>
- <tbody>
- <c:forEach var="osoba" items="${osoby.rows}" varStatus="status">
- <c:choose>
- <c:when test="${status.index mod 2 == 0}">
- <c:set var="tdclass" value="hi" />
- </c:when>
- <c:otherwise>
- <c:set var="tdclass" value="lo" />
- </c:otherwise>
- </c:choose>
- <tr>
- <td class="${tdclass}">${osoba.prijmeni}</td>
- <td class="${tdclass}">${osoba.jmeno}</td>
- <td class="${tdclass}">${osoba.adresa}</td>
- <form action="del.jsp" method="POST">
- <td class="${tdclass}}">
- <input type="hidden" value="${osoba.id}" />
- <input type="submit" value="<fmt:message key="index.del" />" />
- </td>
- </form>
- </tr>
- </c:forEach>
- </tbody>
- </table>
- <form name="addressForm" action="add.jsp" method="POST">
- <table style="background: #e0e0e0" cellpadding="5" class="bordered">
- <tr>
- <td colspan="2"><fmt:message key="index.new" /></td>
- </tr>
- <tr>
- <td align="right"><fmt:message key="index.lastname" /></td>
- <td alignd="left"><input type="text" name="prijmeni" value="" size="" /></td>
- </tr>
- <tr>
- <td align="right"><fmt:message key="index.firstname" /></td>
- <td alignd="left"><input type="text" name="jmeno" value="" size="" /></td>
- </tr>
- <tr>
- <td align="right"><fmt:message key="index.address" /></td>
- <td alignd="left"><textarea name="adresa" rows="3" cols="20"></textarea></td>
- </tr>
- <tr>
- <td align="center" colspan="2">
- <input type="submit" value="<fmt:message key="index.submit" />" />
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment