Is there a way to call two classes in a controller? when i tried to do it, it gives me the following exception : java.lang.IllegalArgumentException: Invalid type {}, should be {}.
Here is my code :
public void ChangeTest(ActionRequest request , ActionResponse response) {
FirstClass fc = request.getContext().asType(FirstClass .class);
SecondClass sc = request.getContext().asType(SecondClass.class);
BigDecimal test = service.ChangeTest(fc,sc);
response.setFlash(test.toString());
}
you can’t retreive 2 objects from a crontroller using ActionRequest so if your service requires 2 objects, get the child object (by using field getter) from the main object or use the repository to fetch it.