Package org.apache.struts2.components
Interface HtmlConstraintProvider
- All Known Implementing Classes:
StrutsHtmlConstraintProvider
public interface HtmlConstraintProvider
Maps a field's validators onto the HTML attributes a theme should render for it.
The default implementation is deliberately conservative — see StrutsHtmlConstraintProvider.
Applications wanting a less conservative mapping (a rewritten pattern for a
case-insensitive regex, say) should register their own implementation instead.
A type entry in the returned map is discarded: the templates have already written the
input's type by the time the map renders, so changing it needs a template override, not a
provider. Any entry whose name matches an attribute the developer set on the tag is discarded too —
the developer's own value always wins.
- Since:
- 7.4.0
-
Method Summary
Modifier and TypeMethodDescriptionconstraintsFor(List<Validator> validators, HtmlControlType control, Object action, Object value)
-
Method Details
-
constraintsFor
Map<String,String> constraintsFor(List<Validator> validators, HtmlControlType control, Object action, Object value) - Parameters:
validators- the field's validators; may be null or emptycontrol- the kind of control being renderedaction- the object the field's validators run against, used to resolve i18n validator messages: the action, or the visited object for a field reached through avisitorvalidator; may be nullvalue- the field's current value as the tag resolved it — what the page renders and, for a control that omits its parameter when left empty, what the server will validate on such a submit; may be null- Returns:
- attribute name to value; never null, possibly empty
-