FileDocCategorySizeDatePackage
ZipCodeRenderer.javaAPI DocExample2492Sun Jan 28 14:19:40 GMT 2007com.oreilly.ajax

ZipCodeRenderer

public final class ZipCodeRenderer extends javax.faces.render.Renderer
author
steveo

Fields Summary
Constructors Summary
Methods Summary
public voidencodeBegin(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)

    ResponseWriter writer = context.getResponseWriter();
    Map attributeMap = component.getAttributes();
    Object o = attributeMap.get("zipcodeId");
    writer.startElement("script", component);
    writer.writeAttribute("type", "text/javascript", null);
    // this should be an attribute. Just like cityId is.
    String src = "scripts/ora-ajax.js";
    writer.writeAttribute("src", src, null);

    writer.endElement("script");

    writer.startElement("div", component);
    writer.writeAttribute("id", "ajaxDivId", null);
    writer.endElement("div");
    writer.write("\n");
    writer.startElement("table", component);
    writer.startElement("tr", component);
    writer.startElement("td", component);
    writer.write("Zip Code: ");
    writer.endElement("td");
    writer.startElement("td", component);
    writer.startElement("input", component);
    writer.writeAttribute("onblur", "retrieveCityState();", null);
    writer.writeAttribute("type", "text", null);
    writer.writeAttribute("id", "zipcodeId", null);
    writer.endElement("td");
    writer.endElement("tr");

    writer.startElement("tr", component);
    writer.startElement("td", component);
    writer.write("City: ");
    writer.endElement("td");
    writer.startElement("td", component);
    writer.startElement("input", component);
    writer.writeAttribute("type", "text", null);
    writer.writeAttribute("id", "cityId", null);
    writer.endElement("td");
    writer.endElement("tr");

    writer.startElement("tr", component);
    writer.startElement("td", component);
    writer.write("State: ");
    writer.endElement("td");
    writer.startElement("td", component);
    writer.startElement("input", component);
    writer.writeAttribute("type", "text", null);
    writer.writeAttribute("id", "stateId", null);
    writer.endElement("td");
    writer.endElement("tr");
    writer.endElement("table");

    writer.write("\n");
  
public voidencodeEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)


  
public booleangetRendersChildren()

    return true;