In order to form a hyperlink against a field using groovy, we have a method which will give output as a link provided in the groovy.
Below is a sample.
public String getObjectDisplayValue(Object object, Object attributeObject, String attributeId, String attributeType, boolean isInEditModel) {
if ("customAttributes.string3".equalsIgnoreCase(attributeId) && "customLink".equals(attributeType)) {
if (super.isNullOrEmptyValue(attributeObject)) {
return "N/A";
} else
return "<a href='http://www.agiliance.com' target='_blank'>" + super.getObjectDisplayValue(attributeObject)+ "</a>";
}
return super.getObjectDisplayValue(attributeObject);
}
}
This hyperlink formation will get blocked if ESAPI Validatior.URL properties file(C:\Server\Tomcat\webapps\spc\WEB-INF\classes\esapi)) does not have characters provided in the hyperlink. So to allow this we have to add those characters in Validatior.URL properties file.
By replacing the below property will make sure to by pass all the characters that URL might have.
#Validator.URL=^(ht|f)tp(s?)\\:\\/\\/[0-9a-zA-Z ]([-.\\w]*[0-9a-zA-Z ])*(:(0-9)*)*(\\/?)([a-zA-Z0-9 \\-\\.\\?\\,\\:\\'\\/\\\\\\+_={}&%\\$#ÀÈÌÒÙàèìòùÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÃÑÕãñõÄËÏÖÜŸäëïöüŸ¡¿çÇŒœßØøÅåÆæÞþÐ𶧥«»’„”“”–€œŒ ]*)?$
replaced by
Validator.URL=^.*$
Please make sure there should be no space after $.