Quick Start > Step 3: JotResponseBean

Step 3: JotResponseBean

In the third step, the JOT Servlet (step 2) is configured with a JotResponseBean that uses the JOT Template (step 1). Here is an example JotResponseBean:

    package quickstart;
    import com.jotobjects.servlet.*;

    public class QuickStartBean
        extends JotServletResponseBean
    {
      private String fooField = "init";

      public void setFoo(String foo)
      {
        this.fooField = foo;
      }
      public String getFoo()
      {
        return fooField;
      }
      public java.util.Date getNow()
      {
        return new java.util.Date();
      }
    }

An HTTP request from a client browser causes the set methods to update JOT Bean properties with request parameters (from the URL query string or HTML Form input elements). In this example the setFoo() method is called.

When a servlet request is received, the response to the client uses QuickStart.html, the JOT Template from step 1. Dynamic content is rendered with the JOT Bean getNow() and getFoo() methods that correspond to the JOT.Now and JOT.Foo JOT Tokens in QuickStart.html.

This is a basic example. Advanced JOT Template scripting and JOT Bean software techniques are covered in the Programming Guide and demonstration servlets.

© 2007 JOT Object Technologies