In Germany we can use domaine-names like "münchen.de".
The struts validators URLValidator and EmailIdnValidator can't handle such name
with umlaut.
The domaine is valide but not for the validator.
Is it possible to change this behavior?
I overwrite the classes and it works for me.
But I think it's better to change the standard classes,
Here my solution:
import com.opensymphony.xwork2.validator.ValidationException;
import com.opensymphony.xwork2.validator.validators.URLValidator;
import java.net.IDN;
import java.util.Objects;
public class URLIdnValidator extends URLValidator
{
@Override
public Object getFieldValue(String name, Object object) throws
ValidationException
{
Object fieldValue = super.getFieldValue(name, object);
if (fieldValue != null)
{
fieldValue = IDN.toASCII(Objects.toString(fieldValue, "")); // need Java
1.6
}
return fieldValue;
}
}
Thanks for your attention.
Best wishes
Günter
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]