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

The Template Manager

In JWIG, we can browse and edit all the XML templates in a template manager.

This is in fact just another JWIG service, TempMan.jwig

In particular, we can interactively modify the graphical design during the lifetime of a running session thread!

This requires that we use the get operation:

import dk.brics.jwig.runtime.*;

public class TempEx extends Service {
  static XML templateWrapper;
  static XML templateHello;
  static XML templateGoodbye;

  public TempEx() {refresh();}

  static void refresh() {
    try {
      templateWrapper = get "file:/home/mis/TempEx/templates/Wrapper";
      templateHello = get "file:/home/mis/TempEx/templates/Hello";
      templateGoodbye = get "file:/home/mis/TempEx/templates/Goodbye";
    } catch (Exception e) { e.printStackTrace(); }
  }

  public class Refresh extends Page {
    public void main() {
	refresh();
    }
  }

  public class Example extends Session {
    public void main() {
      show templateWrapper<[what=templateHello];
      exit templateGoodbye;
    }
  }
}

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