Client sends String [] instead of BigDecimal to server on update

When a new entry works peacefully , the problem is in the update .

I have an object A , which is the main, other B object, which is ArrayList

, and part master A , and for the last object the C , which represents ArrayList

and detail of the object B .

When I post information to the server and index

object B is 0 and the part that is object C is not null, it works well without complaint to convert String[]

to BigDecimal

.

But when I send to the server the information and index

object B is higher than 0 and the part that is C is not null, accusing it of trying to convert String[]

to BigDecimal

and returning an error.

org.springframework.validation.BeanPropertyBindingResult: 3 errors Field error in object 'A' in field 'B 1 .C [0] .attribute': rejected value [190.67.190.67]; ...

As defined in my JSP file that I populate with AngularJS when the user clicks on a button to create a new item in object C:

name='B[{{B.index}}].C[{{C.index}}].attribute'

      

As defined in the model:

@Column(name = "ATTRIBUTE")
@NotNull(message = "{validate.required.attribute}")
@NumberFormat(pattern = "0.00")
private BigDecimal attribute;

      

Printing JavaScript screens in dispatching a form event:

AngularJS Objects

enter image description here

Any solution to this problem? Apparently I believe that the definition in the name attribute to generate objects correctly at the server level is correct, even more so than storing in the database, when it is a new record, there is a problem when updating the form and when object B has object C which is not null and is at an index higher than 0, causing the String attribute to appear as an error, given that it appears to have been multiplied by many elements that have a B or B object .

The question is, how can I fix this, which seems to be correct?

For an answer to this question in Portuguese, I am creating another question on the Portuguese Stackoverflow, click here to open the link .

Para responder esta questão em português eu criei outra questão no Stackoverflow Português, clique aqui para abrir o link .

+1


source to share





All Articles