0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Hibernate Validator の使い方メモ

Last updated at Posted at 2018-09-27

自分用の覚書のつもりで書いています。
書きかけです。

:frowning2: はまったポイント:パラメータの順番】

public String confirm(HttpServletRequest request, Model model
		, @Validated @ModelAttribute("user") User user
		, @RequestParam("mode") String mode
		, BindingResult result) {

だと結果が、
Error画面.jpg
になりました。
で、以下のように、
@Validated をつけたパラメータと、BindingResult を並べる形に、
パラメータの並び順を変更しました。

public String confirm(HttpServletRequest request, Model model
		, @RequestParam("mode") String mode
		, @Validated @ModelAttribute("user") User user
		, BindingResult result) {

これで成功しました。

【参考になるサイト】

制約条件の使い方がわかりやすい
:point_right_tone3: VALIDATOR リファレンスガイド

メッセージのデフォルト値はここで見られるっぽい
:point_right_tone3: Git > ValidationMessages.properties

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?