Calling Java Directly from AJAX in GSP

27 Views Asked by At

I'm a newbie to web dev and need some advice.

We currently have a customisation deployed on a third party application that uses GSP to accept user input and then sends that to the custom JAVA (Calls REST API) via controller to validate/verify inputs etc.. The GSP uses AJAX to make the calls.

$.ajax({ async:false, url:"${request.contextPath}/roles/attrs", type:"post", dataType:"html", data:qs, success:function (returnData) { returnDataResult=returnData }

After an upgrade to the application we are unable to have a custom controller and can only make updates to the GSP and Custom Java.

I'm trying to find a way to do what was being done above using the controller but without having a controller.

Some use cases:

User inputs data to create a new account, the request is pushed to the Java which calls a REST API to check if an account with email already exists, or multiple accounts exist. The account are then presented back to the user so they can pick one or create a new one. Thanks in adavance. Oz

I have tried calling the java directly via scriplets in the GSP. But that doesn't really help with the interactivness required from the UI.

Thank, SG

Expecting GSP to behave the same way without the controller. Even though it might not be best practice.

0

There are 0 best solutions below