I have some code which works Ok with jodd 3.9.1 and I want to upgrade it to jodd version 4.1.4. but I have some errors:
Example:
@POST @Action
public String save(){
... some code for validation
if (!valid){
return VTOR_JSON; //Error
}
service.store(Object);
return NONE; //Error
}
Exception:
jodd.madvoc.MadvocException: Invalid result name:vtor_json (or Invalid result name:none)
at jodd.madvoc.component.ResultsManager.lookup(ResultsManager.java:181)
at jodd.madvoc.component.MadvocController.render(MadvocController.java:183)
at jodd.madvoc.ActionRequest.lambda$createExecutionArray$0(ActionRequest.java:208)
at jodd.madvoc.ActionRequest.invoke(ActionRequest.java:237)
at jodd.madvoc.component.MadvocController.invoke(MadvocController.java:154)
at jodd.madvoc.MadvocServletFilter.doFilter(MadvocServletFilter.java:108)
What is the problem?
How to solve this?
Let me explain:)
With Jodd v4 we don't have anymore the VTOR_JSON type of results - those that return strings. (The string constant is still there, but it is not used). We had to remove this way of returning results as it is not scalable - simply can not add easily different result types.
How to fix it?
We are back to basic :) VTOR_JSON was returning the JSON with the error. So now you have few options (as you can see here):
PathResulthelper object;In a short, you should do this by yourself - but don't worry its super easy. For example, you can return:
If
nullis not working, try returningnew NoneActionResult()(sorry, we will add more convenient way).Checkout the results package: results.
Sorry for this transition, it is really for good purpose. We will add more helpers like
JsonResult. And of course, if you need any support, let us know.