Java – @ requestparam validation

Is there a way to validate a request parameter with spring without checking it in every function?

Solution

If you use @ requestbody to use the form support object, you can use jsr-303 bean validation, where you can annotate the form bean For more information, see http://static.springsource.org/spring/docs/current/spring-framework-reference/html/validation.html#validation -beanvalidation. Then you don't need to disturb the validator object or other code - you just comment

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>