code: public String buildSelectTemplates(String attributes) {
  
          List<String> options = new ArrayList<String>();
          List<String> values = new ArrayList<String>();
          int selectedValue = -1;
          String currentTemplate = null;
          TreeMap<String, String> templates = null;
          try {
              // read the current template
              currentTemplate = getCms().readPropertyObject(
                  getParamResource(),
                  CmsPropertyDefinition.PROPERTY_TEMPLATE,
                  true).getValue();
              // get all available templates
              templates = CmsNewResourceXmlPage.getTemplates(getCms(), getParamResource());
          } catch (CmsException e) {
              // ignore this exception
              if (LOG.isInfoEnabled()) {
                  LOG.info(Messages.get().getBundle().key(Messages.LOG_READ_TEMPLATE_FAILED_0), e);
              }
          }
          if (currentTemplate == null) {
              currentTemplate = "";
          }
          if (templates == null) {
              // no valid template found, use only current one
              addCurrentTemplate(currentTemplate, options, values);
          } else {
              boolean found = false;
              // templates found, create option and value lists
              Iterator<Entry<String, String>> i = templates.entrySet().iterator();
              int counter = 0;
              while (i.hasNext()) {
                  Entry<String, String> entry = i.next();
                  String key = entry.getKey();
                  String path = entry.getValue();
                  if (currentTemplate.equals(path)) {
                      // mark the currently selected template
                      selectedValue = counter;
                      found = true;
                  }
                  options.add(key);
                  values.add(path);
                  counter++;
              }
              if (!found) {
                  // current template was not found among module templates, add current template as option
                  addCurrentTemplate(currentTemplate, options, values);
                  selectedValue = 0;
              }
          }
  
          String hiddenField = "<input type=\"hidden\" name=\""
              + PREFIX_HIDDEN
              + CmsPropertyDefinition.PROPERTY_TEMPLATE
              + "\" value=\""
              + currentTemplate
              + "\">";
          return buildSelect(attributes, options, values, selectedValue, false) + hiddenField;
      }
docs: Builds the html for the page template select box.<p>
  
  @param attributes optional attributes for the &lt;select&gt; tag
  @return the html for the page template select box