在使用ztree插件實現異步加載時遇到后台RESTEasy接收參數問題,查看后台報錯:
A servlet request to the URI http://localhost:8080/area/query contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters.
Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected.
根據錯誤提示,需要使用@FormParam("code")接收ztree出來的參數
ztree異步加載配置:
async: {
enable:true,
url:"/area/query", //點擊父節點,調用@Path("query")方法
autoParam:["id=code"],//給id起別名,后台接收code
}