/** * Replace the vars value with the key/value pairs passed in. */ private void processVars(String key, String replaceValue) { Iterator<String> i = getVarMap().keySet().iterator(); while (i.hasNext()) { String varKey = i.next(); Var var = this.getVar(varKey); var.setValue(ValidatorUtils.replace(var.getValue(), key, replaceValue)); } }
Var var11 = field1.getVar("var-1-1"); assertNotNull("var-1-1 is null.", var11); assertEquals("var-1-1 name is wrong", "var-1-1", var11.getName()); Var var21 = field2.getVar("var-2-1"); assertNotNull("var-2-1 is null.", var21); assertEquals("var-2-1 name is wrong", "var-2-1", var21.getName()); Var var22 = field2.getVar("var-2-2"); assertNotNull("var-2-2 is null.", var22); assertEquals("var-2-2 name is wrong", "var-2-2", var22.getName());
String key = i.next(); String key2 = TOKEN_START + TOKEN_VAR + key + TOKEN_END; Var var = this.getVar(key); String replaceValue = var.getValue();
/** * Replace the vars value with the key/value pairs passed in. */ private void processVars(String key, String replaceValue) { Iterator i = this.hVars.keySet().iterator(); while (i.hasNext()) { String varKey = (String) i.next(); Var var = this.getVar(varKey); var.setValue(ValidatorUtils.replace(var.getValue(), key, replaceValue)); } }
/** * Replace the vars value with the key/value pairs passed in. */ private void processVars(String key, String replaceValue) { Iterator<String> i = getVarMap().keySet().iterator(); while (i.hasNext()) { String varKey = i.next(); Var var = this.getVar(varKey); var.setValue(ValidatorUtils.replace(var.getValue(), key, replaceValue)); } }
/** * Get the value of a variable. * * @param varName The variable name * @param field the validator Field * @param validator The Validator * @param request the servlet request * @param required Whether the variable is mandatory * @return The variable's value */ public static String getVarValue(String varName, Field field, Validator validator, HttpServletRequest request, boolean required) { Var var = field.getVar(varName); if (var == null) { String msg = sysmsgs.getMessage("variable.missing", varName); if (required) { throw new IllegalArgumentException(msg); } if (log.isDebugEnabled()) { log.debug(field.getProperty() + ": " + msg); } return null; } ServletContext application = (ServletContext) validator.getParameterValue(SERVLET_CONTEXT_PARAM); return getVarValue(var, application, request, required); }
String key = i.next(); String key2 = TOKEN_START + TOKEN_VAR + key + TOKEN_END; Var var = this.getVar(key); String replaceValue = var.getValue();
String key = (String) i.next(); String key2 = TOKEN_START + TOKEN_VAR + key + TOKEN_END; Var var = this.getVar(key); String replaceValue = var.getValue();