Field List of a jsp

Asked

Viewed 78 times

0

This field is filled in correctly by a query made in the DAO.

The problem is that you are not accepting the object as null or as the value by the ID.

The entity’s field is

Man

@ManyToOne
    @JoinColumn(name = "cos_id_id")
    public CosifEntity getCosif() {
        return cosif;
    }

    public void setCosif(CosifEntity cosif) {
        this.cosif = cosif;
    }

I have this eclipse log error.

Field error in object 'cosifEntity' on field 'cosif': rejected value []; codes [typeMismatch.cosifEntity.cosif,typeMismatch.cosif,typeMismatch.br.com.netsoft.desif.model.desif.federal.CosifEntity,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [cosifEntity.cosif,cosif]; arguments []; default message [cosif]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'br.com.netsoft.desif.model.desif.federal.CosifEntity' for property 'cosif'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [br.com.netsoft.desif.model.desif.federal.CosifEntity] for property 'cosif': no matching editors or conversion strategy found]

jsp looks like this for this field:

Man

<select class="chosen-select form-control" id="cosif" name="cosif" data-placeholder="Selecione uma COSIF">
 <option value=""></option>
 <c:forEach var="contaSuperior" items="${listaContaSuperior}">
 <option value="${contaSuperior.id}">
 ${contaSuperior.numeroNome}</option>
 </c:forEach>
</select>

What can it be ?

  • How to convert the chosen record to the class before persisting.

1 answer

0

From what I understand the problem is not in your file .jsp, at least for the time being.

The mapping is bringing the column cos_id_id and is giving conversion error (to String). Probably this is happening within the class CosifEntity.

Check her mapping status.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.