示例#1
0
  public static String format(Object o, String defaultHTML) {
    String s = Text.toString(o, null);

    if (Text.isEmpty(s)) {
      s = defaultHTML;
    } else {
      s = s.trim();
      s = HTML.escape(s);
      s = escapeNotAscii(s);
    }

    return s;
  }
示例#2
0
  /**
   * Create a hidden form fields from the parameterMap
   *
   * @param parameterMap String[] values, keyed parameter names
   * @return a series of hidden form fields like <input type="hidden" name="..." value="..."
   *     />
   */
  public static String hiddenFormFields(Map parameterMap) {
    StringBuffer sb = new StringBuffer();
    Iterator iter = parameterMap.keySet().iterator();

    while (iter.hasNext()) {
      String param = (String) iter.next();
      String[] values = (String[]) parameterMap.get(param);
      for (int i = 0; i < values.length; i++) {
        sb.append(HTML.hiddenFormField(param, values[i]));
        sb.append("\r\n");
      }
    }

    return sb.toString();
  }
示例#3
0
 public static String optionAttribs(Long optionValue, String[] requestValue) {
   return HTML.optionAttribs(optionValue.toString(), requestValue);
 }
示例#4
0
 public static String checkboxAttribs(Long optionValue, String[] requestValues) {
   return HTML.checkboxAttribs(optionValue.toString(), requestValues);
 }
示例#5
0
 public static String checkboxAttribs(Long optionValue, String requestValue) {
   return HTML.checkboxAttribs(optionValue.toString(), new String[] {requestValue});
 }
示例#6
0
 public static String printSelectedAttribs(
     String optionValue, String requestValue, String toPrint) {
   return HTML.printSelectedAttribs(optionValue, new String[] {requestValue}, toPrint);
 }
示例#7
0
 public static String printSelectedAttribs(
     Long optionValue, String[] requestValue, String toPrint) {
   return HTML.printSelectedAttribs(optionValue.toString(), requestValue, toPrint);
 }
示例#8
0
 /**
  * Creates attributes for use in an HTML &lt;option&gt; tag.
  *
  * @param optionValue value attribute of &lt;option&gt;
  * @param requestValue current value of &lt;select&gt; box, usually from HTTP request.
  * @return value and selected attribute declarations, where appropriate
  */
 public static String optionAttribs(String optionValue, String requestValue) {
   return HTML.optionAttribs(optionValue, new String[] {requestValue});
 }