Can we invoke ATG FormHandler thu AJAX ?Do I have a hope ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Generally: Yes 🙂
But the possibilities may be limited or require some weird hacks to get them running, so it may depend on what exactly you want to do.
There are several different approaches:
You cannot directly send requests to a form handler, like you could do it with a servlet or a controller in frameworks like Struts or Spring MVC, but instead you always have to have a form in the JSP page (created using the DSP taglib), and then submit that form. This means that you cannot trigger a form handler without having an according form for it in your JSP page. But if you have that form in your page, you can submit it via an AJAX request. Your AJAX request will then trigger the form handler and get the result back, in the same way as a normal form submission would. This approach is possible and generally works. If you don’t want to have a form for your AJAX request visible in the page, you could hide it e.g. using CSS.
Another approach would be using ATG’S REST Web Services module, which allows you to expose any component as a RESTful web service. This also allows you to invoke form handlers without the need to have a form for them or first render a JSP page. The document titled “ATG Web Services and Integration Framework Guide” (from Oracle’s ATG documentation) has a whole chapter on how to invoke a form handler as a REST Web Service.
Or you could write a small custom servlet that receives your AJAX request and then uses the received data to invoke the form handler, just like it would lookup and invoke any other Nucleus component…