Is it possible to set a model attribute from an ajax call to a FragmentController method that has a FragmentModel or PageModel as a parameter?
My ajax call is made when a user on the fragment list is clicked
jq.ajax({
type: "GET",
url: '${ui.actionLink( "openmrscustom", "admin/account", "getUserAccount" )}',
global: false,
async: false,
data: {
personId: personId,
},
success: function (data) {
jq("#editAccountModal").modal('show');
}
});
My method on the controller
public String getUserAccount(PageModel model, @RequestParam(value = "personId") Integer personId) {
System.out.println(new Account(Context.getPersonService().getPerson(personId)).toString());
model.addAttribute("account", "Account");
return null;
}
the problem I have is the model.addAttribute throws a null pointer