入力値のバリデート 今週の最後は、入力値のバリデートです。バリデートって何?と聞かれると、早い話が 「入力項目に不備があったら、門前払いして、jspに戻す」ということです。 例としては、以下のような「門前払い」が考えられます。 入力必須項目が未記入だった 半角数値の入力欄に、数値以外の文字列が入っていた 6文字以上の文字列が必要なのに、文字列長が足りなかった Login時のバリデート実装 本記事では、Login時にaccountが空欄だと、バリデートエラーとする例を実装します。 SimpleFormController には、下記の バリデートを組み込む場所が準備されており、 validateでエラーを検出すると、そもそも onSubmit() をコールせずに、login.jspに戻ります ( onSubmit()をコールしないというのが「門前払い」の意味 ) login.jspでform