Question

I have a playframework project where I have successfully imported a jar that contains a model I want to utilize. I am able to reference it perfectly from the both the controller and *scala.html code.
The form also renders and operates correctly as expected.
However, on form submit, when I do a myform.bindFromRequest() ,
bad behavior occurs.

  1. If the model does not have any "validation" tags, (e.g @Required). the bindFromRequest().get() will return the correct object type , but empty (all fields 0/null), and all the true data is inside the "data"field .

  2. if the model does have validation tags, I get an exception, [IllegalStateException: JSR-303 validated property 'txid' does not have a corresponding accessor for data binding - check your DataBinder's configuration (bean property versus direct field

When this identical model(class file) is placed directly inside my play project, it works perfectly as expected.

Is there a rule that says I can't utilize classes from external libraries as my models,

thanks

Was it helpful?

Solution

Make sure your model class has all of the getter and setter methods for its fields. These are usually generated automatically by the framework, but it may not work for external classes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top