Applety, Servlety a JSP
| Úvod | Inštalácia Mavenu | Ukážkový projekt |
Applet: pom.xml | Servlet: pom.xml | Servlet: web.xml | Linky | Úlohy |
<%@ page import="java.util.*, java.sql.*" contentType="text/html; charset=UTF-8" %>
<html>
<head>
<title>test</title>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="pragma" content="no-cache"/>
</head>
<body>
<h1>Aj em JSP .. see?</h1>
<p>first .. include header .. by relative path:<br/>
<%@ include file="../include/header.html" %>
<p>
scriptlet example 1:
<ul>
<%
for(int i = 0; i < 10; i++){
out.println("<li>wod a counter: ["+i+"]</li>");
}
%>
</ul>
<p>
scriptlet example 2: wod a date: <% out.println(new java.util.Date()); %>
<p>
expression date example: wod a date: <%= new java.util.Date() %>
<p>
declaration - expression example:<br/>
<%! String suffix = ".hua";
private String doSuffix(String txt){
return txt + suffix;
}
%>
wod d hell is this: [<%= doSuffix("my-input") %>]
<p>now .. include footer .. by absolute path:<br/>
<%@ include file="/include/footer.jsp" %>
</body>
</html>