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; }
/** * 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(); }
public static String optionAttribs(Long optionValue, String[] requestValue) { return HTML.optionAttribs(optionValue.toString(), requestValue); }
public static String checkboxAttribs(Long optionValue, String[] requestValues) { return HTML.checkboxAttribs(optionValue.toString(), requestValues); }
public static String checkboxAttribs(Long optionValue, String requestValue) { return HTML.checkboxAttribs(optionValue.toString(), new String[] {requestValue}); }
public static String printSelectedAttribs( String optionValue, String requestValue, String toPrint) { return HTML.printSelectedAttribs(optionValue, new String[] {requestValue}, toPrint); }
public static String printSelectedAttribs( Long optionValue, String[] requestValue, String toPrint) { return HTML.printSelectedAttribs(optionValue.toString(), requestValue, toPrint); }
/** * Creates attributes for use in an HTML <option> tag. * * @param optionValue value attribute of <option> * @param requestValue current value of <select> 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}); }