### Getting started with the DHTML API

How to get an instance of DHTML API

Note that before you can use the following methods to get a DHTML API instance, firstly you need to import some relevant packages. For instance, jet.web.dhtml.* must be included here.

- For local use

  Both of the following methods can be used to get an instance of the DHTML API locally. The results of these two methods are exactly the same.

  - Method 1:

    `DHTMLClientService service = DHTMLServiceFactory.getDHTMLClientService(request);`

  - Method 2:

        HttpRptServer server;
        if (System.getProperty(APIConst.REMOTE_DISPATCHER) == null) {
            server = HttpUtil.getHttpRptServer();
        } else {
            server = RemoteDispatcherFactory.getInstance().getDispatchedServer(request);
        }
        DHTMLClientService service = (DHTMLClientService)server.getDHTMLClientService();

- For RMI use

  This method can be used to get an instance of DHTML API from a remote server (RMI).

      HttpRptServer server;
      if (System.getProperty(APIConst.REMOTE_DISPATCHER) == null) {
          server = HttpUtil.getHttpRptServer();
      } else {
          server = RemoteDispatcherFactory.getInstance().getDispatchedServer(request);
      }
      DHTMLClientService service = server.getDHTMLClientService();