Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8836369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:28:43+00:00 2026-06-14T09:28:43+00:00

I am using Java Play 2.0.1 with both custom validation and the play.data.validation.constraints, and

  • 0

I am using Java Play 2.0.1 with both custom validation and the play.data.validation.constraints, and am looking for a means to display every error that occurs in the form regardless of whether my code is validating or if Play is.

What I am presently doing to display all errors, is I have a method in my Controller to add all of the errors contained within the Map retrieved from form.errors(), and then add them to the flash scope, which does the job in the sense that all errors will be detected, but not displayed on the first redirect until the play.data.validation errors are fixed.

public static void addFlashError(Map<String, List<ValidationError>> errors){
      for(String key : errors.keySet()){
          List<ValidationError> currentError = errors.get(key);
          for(ValidationError error : currentError){
              flash(key, error.message());
          }
      }   
  }

Then in my scala.html to display the errors

    <div class="alert-message error">
        @for((key, value) <- flash){
            <strong>Error : </strong> @value<br />
        }
    </div> 

But this does not seem to be the most simple solution, and Play does not display the custom validation errors at the same time as the play.data.validation errors, as it appears as though the play.data.validation errors are displayed, and then if there are none Play checks to see if there is a public String validate() contained in the class the form wraps.

Is there a simple approach to display all errors in the form, and not play.data.validation errors and then custom validation errors if the play.data.validation errors do not exist?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:28:44+00:00Added an answer on June 14, 2026 at 9:28 am

    What I’ve done is to call form.hasErrors() and store that value in a variable. Next you do all of your custom validation. Grab form.errors() (as you were doing) and if you find any errors then insert them directly into that map. If there were any validation errors then return with a badRequest() as usual passing in your Form instance (which contains the error map with all of the errors).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a web application using Java Play Framework 2.0 that heavily relies
I want to perform some AJAX style data retrieval using the Java Play Framework
I am using Clip in java to play a song as follows: MR.clip= (Clip)
What role does SSLSocketFactory class in java play when using HttpsURLConnection ? The java
I'm new to Eclipse and am using it currently to play with Java EE.
Using Java (1.6) I want to split an input string that has components of
Using Java sockets, I made a simple server. This works because it sends data
I am using Java JMF to play a MPEG video with sound. I want
Hi has anyone had any experience using both Stripes and Play and can compare
I'm attempting to play with graphics using Java/Slick 2D. I'm trying to get my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.