I often use autocomplete for multiple fields on my views. These fields might be from one domain or different domains. Instead of creating multiple actions to handle each request, I created a Tag and a Service to make things easier.
The idea is the jQuery will handle the front end by sending the request to controller and displaying the returned json results in a list. So what I just needed to do was to route that request to a service to get the json result and sent it back to the view. The autoComplete tag make it reusable and the service take care of the rest. This way I will just need to set the domains and property in the gsp. The rest will be handled consistently.
I want to add autocomplate to my author and isbn field on my view. Each coming from different domain. I just need to set my tags parameters and send it to autoComplete action in one controller.
Add the following tag in your gsp with the information about the domain and field: