NOTE:
These slides have not been updated since 2003. They have been superseded by the book
Anders Møller and Michael Schwartzbach, February 2006 |
INTERACTIVE WEB SERVICES WITH JAVA |
<html><head><title>JSP</title></head> <body><h1>Hello World!</h1> This page was last updated: <%= new java.util.Date() %> </body></html> |
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html><head><title>Servlet</title></head>"); out.println("<body><h1>Hello World!</h1>"); out.println("This page was last updated: " + new java.util.Date()); out.println("</body></html>"); } } |
import dk.brics.jwig.runtime.*; public class Hello extends Service { public class Example extends Session { public void main() { XML x = [[ <html><head><title>JWIG</title></head><body> <h1><[what]></h1></body></html> ]]; x = x <[ what = [[ Hello World! ]] ]; show x; } } } |
Note that: