简体   繁体   English

@NotEmpty注释的Spring Boot示例

[英]Spring Boot example for @NotEmpty annotaion

I am developing spring boot application which has freemarker for UI. 我正在开发具有用于UI的freemarker的spring boot应用程序。 I want to use @NotEmpty annotation for radio button. 我想对单选按钮使用@NotEmpty批注。 eg "input type="radio" 例如“ input type =” radio“

I can see examples on internet but they are with form tag(spring tag). 我可以在互联网上看到示例,但它们带有表单标签(弹簧标签)。

Can someone give me example for above without form tag. 有人可以给我上面没有表单标签的示例。

You can use 您可以使用

<@spring.formRadioButtons "x.y"/>
<@spring.showErrors "<br>"/> 

to display the validation messages. 显示验证消息。

Have a look at this tutorial: 看一下本教程:

https://hellokoding.com/form-data-binding-and-validation-example-with-java-spring-boot-and-freemarker/ https://hellokoding.com/form-data-binding-and-validation-example-with-java-spring-boot-and-freemarker/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM