previous | index | next

Writing the UISpinner Class

The spinner generates HTML for a text field and two buttons.

The HTML should have this form:

   <input type="text" name="..." value="current value" size="..."/>
   <input type="submit" name="..." value="<"/>
   <input type="submit" name="..." value=">"/>

We will delegate the encoding of each to helper methods:

   public void encodeBegin(FacesContext context) throws IOException {
      ResponseWriter writer = context.getResponseWriter();
      String clientId = getClientId(context);

      encodeInputField(writer, clientId);
      encodeDecrementButton(writer, clientId);
      encodeIncrementButton(writer, clientId);
   }


previous | index | next