private String trimParameterName(ActionConfig actionConfig, String name) { String stripped = name; String prefix = actionConfig.getPrefix(); String suffix = actionConfig.getSuffix(); if (prefix != null) { if (!stripped.startsWith(prefix)) { return null; } stripped = stripped.substring(prefix.length()); } if (suffix != null) { if (!stripped.endsWith(suffix)) { return null; } stripped = stripped.substring(0, stripped.length() - suffix.length()); } return stripped; } }
/** * <p>For a given request parameter name, trim off any prefix and/or * suffix which are defined in <code>actionConfig</code> and return what * remains. If either prefix or suffix is defined, then return null for * <code>name</code> values which do not begin or end accordingly.</p> * * @param actionConfig The ActionConfig we are processing * @param name The request parameter name to proceess * @return The request parameter name trimmed of any suffix or prefix */ protected String trimParameterName(ActionConfig actionConfig, String name) { String stripped = name; String prefix = actionConfig.getPrefix(); String suffix = actionConfig.getSuffix(); if (prefix != null) { if (!stripped.startsWith(prefix)) { return null; } stripped = stripped.substring(prefix.length()); } if (suffix != null) { if (!stripped.endsWith(suffix)) { return null; } stripped = stripped.substring(0, stripped.length() - suffix.length()); } return stripped; }
protected void populate(ActionContext context, ActionConfig actionConfig, ActionForm actionForm) throws Exception { ServletActionContext saContext = (ServletActionContext) context; RequestUtils.populate(actionForm, actionConfig.getPrefix(), actionConfig.getSuffix(), saContext.getRequest()); }
RequestUtils.populate(form, mapping.getPrefix(), mapping.getSuffix(), request);
config.setCommand(convertParam(orig.getCommand(), vars)); config.setMultipartClass(convertParam(orig.getMultipartClass(), vars)); config.setPrefix(convertParam(orig.getPrefix(), vars)); config.setSuffix(convertParam(orig.getSuffix(), vars));