01 package interval;
02
03 import javax.servlet.*;
04 import javax.servlet.http.*;
05 import java.io.*;
06 import java.util.*;
07
08 public class TimeServlet extends HttpServlet {
09 private static final String CONTENT_TYPE = "text/html; charset=windows-1250";
10
11 public void init() throws ServletException {
12 }
13
14 public void doGet(HttpServletRequest request, HttpServletResponse response)
15 throws ServletException, IOException {
16 response.setContentType(CONTENT_TYPE);
17 PrintWriter out = response.getWriter();
18 out.println("<html>");
19 out.println("<head><title>TimeServlet</title></head>");
20 out.println("<body>");
21 out.println("<p>The servlet has received a GET. This is the reply.</p>");
22
23 if (request.getAttribute("comp") != null) {
24 String company = (String) request.getAttribute("comp");
25 out.println(company);
26 }
27 out.println("<p><a href='servlet/interval.TimeServlet' title='Priamy odkaz na servlet.'>TimeServlet...</a>");
28 out.println("</body></html>");
29 out.close();
30 }
31
32 public void destroy() {
33 }
34 }
|