Beispiel #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;
  }
Beispiel #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();
  }
Beispiel #3
0
 public static String optionAttribs(Long optionValue, String[] requestValue) {
   return HTML.optionAttribs(optionValue.toString(), requestValue);
 }
Beispiel #4
0
 public static String checkboxAttribs(Long optionValue, String[] requestValues) {
   return HTML.checkboxAttribs(optionValue.toString(), requestValues);
 }
Beispiel #5
0
 public static String checkboxAttribs(Long optionValue, String requestValue) {
   return HTML.checkboxAttribs(optionValue.toString(), new String[] {requestValue});
 }
Beispiel #6
0
 public static String printSelectedAttribs(
     String optionValue, String requestValue, String toPrint) {
   return HTML.printSelectedAttribs(optionValue, new String[] {requestValue}, toPrint);
 }
Beispiel #7
0
 public static String printSelectedAttribs(
     Long optionValue, String[] requestValue, String toPrint) {
   return HTML.printSelectedAttribs(optionValue.toString(), requestValue, toPrint);
 }
Beispiel #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});
 }