I use bootstrap and springboot
Therefore, I would like to display the bootstrap alerts .
But I can't create a variable that can determine that the errors tag is enabled ...
At first, I tried to enclose the alert part with errors tag, but since it can't nest errors tag, the message prepared in property file cannot be displayed.
Is there an implementation that prepares a variable for determining whether an error has occurred or a message prepared in the property when an error occurs?
Other solutions are also welcome.
Hereafter, write an image when an error occurs.
<% @ page language = "java" contentType = "text/html;charset = UTF-8"%> <% @ taglib prefix = "form" uri = "http://www.springframework.org/tags/form"%> <html> <head> <!-Read js, css-> </head> <body> <!-I want to branch conditionally when an error message is displayed-> <strong><form: errors path = "hoge" /></strong> <button type = "button" data-dismiss = "alert"> <span aria-hidden = "true">×</span> </button> </body> </html>
Answer # 1
It seems that validation error can be judged with
spring: bind tag and status.error.
falseis set in status.error, and
trueindicates that an error has occurred. >c: if.
<% @ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%> <% @ taglib prefix = "spring" uri = "http://www.springframework.org/tags"%>
The status object also has
status.expressionfields, where value is the field value and expression is the field name.
Once it has been confirmed with Spring Framework 5.1.9.RELEASE.
The following articles are helpful for this answer. For more details, check out this article.
Spring MVC Form – Check if a field has an error
- vuejs - i want to use firebase with vs code
- java - i want to use stream api in map
- java - i want to know how to use the functions of app a to operate app b
- php - i want to use \ n to make a line break, but i can't
- mysql - i want to know how to use sql bit
- python - i want to use ads1015 with raspberrypi
- swiftui - i want to use a variable in the name of the image
- onclick - i want to reset the form with react
- android - i want to use an intent from a fragment
- ajax - laravel js want to use
- java - i want to use googlespreadsheet api with kotlin
- i want to implement a django form
- spring boot - i want to insert data using h2, but i can not do it well
- html - i want to use text-align
- i want to know how to use exit do with vba
- i want to use c# linq enumerablerange (not responding)
- i want to send form format text data by post to external api with gas
- i want to use sass with nextjs
- html - offset does not apply
- html - child element is not included in parent element
- css3 - how to arrange side by side in html and css screen layout
- html - boostrap does not apply
- css3 - i am making a slide show the path is fine and the slides are working but the image doesn't look good so i want to be able
- html - bootstrap content width unintentionally
- html - the specification at the time of xs does not work in bootstrap
- css3 - i can't place the login form well in the center of the top and bottom
- html - elements are automatically broken in bootstrap's grid system