Home  >  Q&A  >  body text

java - spring mvc的validator如何支持String类型的参数

PHP中文网PHP中文网2741 days ago609

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-04-18 09:35:54

    Use @Valid to mark the parameter vStr to be verified. When you need to use JSR-303 in SpringMVC, you need to provide an implementation of the JSR-303 specification. Hibernate Validator implements this specification. The verification of JSR-303 is based on annotations, and a series of restriction annotations have been defined internally. We only need to mark these annotations on the attributes of the entity class that need to be verified or on their corresponding get methods.
    You have not implemented it, so of course there will be no verification.

    reply
    0
  • Cancelreply