Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
629 views
in Technique[技术] by (71.8m points)

java - Playframework JSR-303 validated "field" does not have a corresponding accessor for data binding

When I have added this following code to my project

Form<User> filledForm2 = userSignupForm.bindFromRequest();

It has stopped working by showing an error message which states:

Execution exception
[IllegalStateException: JSR-303 validated property 'Password' does not have a corresponding accessor for data binding - check your DataBinder's configuration (bean property versus direct field access)]

My User class was like that:

class User{
String username;
String Password;
}

Now how can to check/modify DataBinder's configuration in java play framework?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Actually this shouldn't be happening, as Play automatically generates getters and setters, see Guillaume's comment.

Therefore it's possible that your IDE is causing issues e.g. Guillaume's comment re Eclipse. Or that your sbt cache is corrupt and needs cleaning, which you can do with play clean-all (read about it here)

By the way, changing your Password attribute to password may have caused the cache to be re-generated and therefore fixed the issue.

Update:

For more recent versions of Play that use activator, it seems the following are the the up-to-date equivalents:

activator clean and activator clean-files


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...