Does anybody have an idea how to use Optional objects on JSP?
I have a class:
@Entity
@Table(name = "projects")
public class Project {
@Expose
@ManyToOne
@JoinColumn(name = "customer_id")
private Customer endCustomer;
....
public Optional<Customer> getEndCustomer() {
return Optional.ofNullable(endCustomer);
}
public void setEndCustomer(Customer endCustomer) {
this.endCustomer = endCustomer;
}
....
}
And i have jsp:
<td>
<form:select class="form-control" id="endCustomer" path="endCustomer.id" tabindex="4">
<form:options items="${endCustomers}" itemValue="id" itemLabel="name"/>
</form:select>
</td>
this part doesn't work for obvious reasons: path="endCustomer.id"
is there a workaround? Thanks!
Try something like this
Related question How to access an object