From 0c6ad7b26c3d5008739534a1a02acf6946833fe3 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Mon, 14 Sep 2020 00:52:57 +0300 Subject: [PATCH] Correct price formatting in add & edit web forms Signed-off-by: Pekka Helenius --- bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java index e43cac1..73eca8e 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/Book.java @@ -13,6 +13,8 @@ import javax.validation.constraints.NotNull; import com.fjordtek.bookstore.validation.CurrentYear; +import org.springframework.format.annotation.NumberFormat; + //import java.sql.Timestamp; //import javax.validation.constraints.PastOrPresent; @@ -112,6 +114,7 @@ public class Book { ) private String isbn; + @NumberFormat(pattern = "#,###,###,###.##") @Digits( integer = 3, fraction = 2, message = "Invalid price, possibly too many decimals"