Hi all,
I try to use a validator dependent on a property within a custom tag class.
My class extends TagSupport and overwrites the doStartTag() method.
In this method I add a validator depending on a property (see below).
First the property is "false" and no validator will be added to the
inExtensionTag. Now (next access to the page) the property will change to
"true" and the output "Setting validator!" shows me, that the validator has
been set. But the validator will never be called!
If I always add the validator (not depending on the property), everything works
fine. The validator will be called on submit.
What is wrong with my approach?
Is there another possibility to do what I want?
Example:
@Override
public int doStartTag() throws JspException {
InExtensionTag inExtensionTag = new InExtensionTag();
inExtensionTag.setPageContext(pageContext);
inExtensionTag.setParent(getParent());
inExtensionTag.setId(id);
inExtensionTag.setLabel(label);
inExtensionTag.setValue(value);
if (isValidationEnabled()) {
System.out.println("Setting validator!");
inExtensionTag.setValidator("#validator.validate}");
}
inExtensionTag.doStartTag();
inExtensionTag.doEndTag();
return super.doStartTag();
}
Best regards,
Alf
--
GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!
http://portal.gmx.net/de/go/dsl02