*/
public String getHref(Object value) {
Context context = getContext();
String uri = ClickUtils.getRequestURI(context.getRequest());
HtmlStringBuffer buffer =
new HtmlStringBuffer(uri.length() + getName().length() + 40);
String prefix = getParameterPrefix();
buffer.append(uri);
buffer.append("?");
buffer.append(ACTION_LINK);
buffer.append("=");
buffer.append(getName());
if (value != null) {
buffer.append("&");
if (StringUtils.isNotBlank(prefix)) {
// Value parameter is prefixed when SubmitLink is included
// inside a Form
buffer.append(prefix);
}
buffer.append(VALUE);
buffer.append("=");
buffer.append(ClickUtils.encodeUrl(value, context));
}
if (hasParameters()) {
Iterator i = getParameters().keySet().iterator();
while (i.hasNext()) {
String name = i.next().toString();
if (!name.equals(ACTION_LINK) && !name.equals(VALUE)) {
Object paramValue = getParameters().get(name);
if (paramValue instanceof String[]) {
String[] paramValues = (String[]) paramValue;
for (int j = 0; j < paramValues.length; j++) {
renderParameter(name, paramValues[j], prefix,
buffer, context);
}
} else {
renderParameter(name, paramValue, prefix, buffer,
context);
}
}
}
}
return context.getResponse().encodeURL(buffer.toString());
}