to the main page about the tutorial  INTERACTIVE WEB SERVICES WITH JAVA back up next

Sessions in JWIG

In CGI-scripts, Servlets, and JSP the session concept is implicit: In JWIG, the session concept is explicit: The "Hello World" example:
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>
                       <form><input type="submit" /></form>
                       </body></html> ]];
            x = x <[ what = [[ Hello World! ]] ];
            show x;
            XML y = [[ <html><head><title>JWIG</title></head><body>
                       Goodbye!</body></html> ]];
            exit y;
        }
    }
}

back COPYRIGHT © 2002-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next