tuxmartin

index

Mar 12th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.14 KB | None | 0 0
  1. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  2. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  3. <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
  4. <%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
  5.  
  6. <!DOCTYPE html>
  7.  
  8. <c:if test="${param.locale != null}">
  9.     <c:set var="locale" value="${param.locale}" scope="session"/>
  10. </c:if>
  11.  
  12. <fmt:setLocale value="${locale}" scope="application" />
  13. <fmt:setBundle basename="messages" scope="application" />
  14.  
  15. <sql:setDataSource
  16.     driver="org.apache.derby.jdbc.EmbeddedDriver"
  17.     user=""
  18.     password=""
  19.     url="jdbc:derby:p:/.netbeans-derby/kontakty"    
  20.     var="db"
  21.     scope="application"  
  22.     />
  23.  
  24. <sql:query var="osoby" dataSource="${db}">
  25.     select * from osoba order by prijmeni, jmeno    
  26. </sql:query>
  27.    
  28. <html>
  29.     <head>
  30.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  31.         <title><fmt:message key="index.title" /></title>
  32.         <link rel="stylesheet" href="styly.css" type="text/css">        
  33.     </head>
  34.     <body>
  35.         <h1><fmt:message key="index.title" /></h1>
  36.        
  37.         <form action="index.jsp" method="POST">
  38.             <fmt:message key="index.lang" />
  39.             <select name="locale">
  40.                 <option>cs_CZ</option>
  41.                 <option>en_US</option>
  42.                 <option>de_DE</option>
  43.                 <option>sk_SK</option>                
  44.             </select>
  45.            
  46.             <input type="submit" value="<fmt:message key="index.change" />" />                      
  47.         </form>
  48.        
  49.         <table border="0" cellpadding="3" cellspacing="0">
  50.             <thead>
  51.                 <tr>
  52.                     <th width="100" align="left"><fmt:message key="index.lastname" /></th>
  53.                     <th width="100" align="left"><fmt:message key="index.firstname" /></th>
  54.                     <th width="200" align="left"><fmt:message key="index.address" /></th>
  55.                     <th width="50"  align="left"><fmt:message key="index.operation" /></th>                    
  56.                 </tr>
  57.             </thead>
  58.            
  59.             <tbody>
  60.                
  61.                 <c:forEach var="osoba" items="${osoby.rows}" varStatus="status">
  62.                    
  63.                     <c:choose>
  64.                         <c:when test="${status.index mod 2 == 0}">
  65.                             <c:set var="tdclass" value="hi" />
  66.                         </c:when>
  67.                         <c:otherwise>
  68.                             <c:set var="tdclass" value="lo" />
  69.                         </c:otherwise>
  70.                     </c:choose>
  71.                    
  72.                     <tr>
  73.                         <td class="${tdclass}">${osoba.prijmeni}</td>
  74.                         <td class="${tdclass}">${osoba.jmeno}</td>
  75.                         <td class="${tdclass}">${osoba.adresa}</td>                        
  76.                        
  77.                 <form action="del.jsp" method="POST">
  78.                     <td class="${tdclass}}">
  79.                         <input type="hidden" value="${osoba.id}" />
  80.                         <input type="submit" value="<fmt:message key="index.del" />" />
  81.                     </td>
  82.                 </form>
  83.                        
  84.                     </tr>
  85.                    
  86.                    
  87.                 </c:forEach>        
  88.                                
  89.             </tbody>
  90.                      
  91.         </table>
  92.        
  93.                 <form name="addressForm" action="add.jsp" method="POST">
  94.                    
  95.                     <table style="background: #e0e0e0" cellpadding="5" class="bordered">                        
  96.                         <tr>
  97.                             <td colspan="2"><fmt:message key="index.new" /></td>
  98.                         </tr>
  99.                        
  100.                         <tr>
  101.                             <td align="right"><fmt:message key="index.lastname" /></td>
  102.                             <td alignd="left"><input type="text" name="prijmeni" value="" size="" /></td>                  
  103.                         </tr>
  104.                        
  105.                         <tr>
  106.                             <td align="right"><fmt:message key="index.firstname" /></td>
  107.                             <td alignd="left"><input type="text" name="jmeno" value="" size="" /></td>                  
  108.                         </tr>
  109.                        
  110.                         <tr>
  111.                             <td align="right"><fmt:message key="index.address" /></td>
  112.                             <td alignd="left"><textarea name="adresa" rows="3" cols="20"></textarea></td>                  
  113.                         </tr>
  114.                        
  115.                         <tr>
  116.                             <td align="center" colspan="2">
  117.                                 <input type="submit" value="<fmt:message key="index.submit" />" />
  118.                             </td>
  119.                         </tr>                        
  120.                     </table>
  121.                    
  122.                    
  123.                 </form>
  124.        
  125.        
  126.        
  127.     </body>
  128. </html>
Advertisement
Add Comment
Please, Sign In to add comment