Q: jQuery-autocomplete with Spring My JavaScript code can't connect to the Spring controller:
$(document).ready(function () {
  $('#nombrePais').autocomplete({
    serviceUrl: 'getTags',
    paramName: "tagName",
    delimiter: ",",
    minLength: 3,
    transformResult: function (response) {
      return {
        suggestions: $.map($.parseJSON(response), function (item) {
          return {
            value: item.nombre,
            data: item.idPais
          };
        })
      };
    }
  });
});

I tried both: ${pageContext.request.contextPath}/getTags and getTags in the controller.
@RequestMapping(value="getTags", method=RequestMethod.GET)
public @ResponseBody
List <Pais> getTags(@RequestParam String tagName) {
    try {
        System.out.println("Entre :)");
        List <Pais> paises = timbreDAO.findAllPaises(tagName);
        return paises;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }


A: try with this.its works for me
<script type="text/javascript">
      $(document).ready(function() {
            $('#tsrId').autocomplete({
                serviceUrl: 'YOUR_URL.html',
                paramName: "tagName",
                delimiter: ",",
                transformResult: function(response) {
                return {suggestions: $.map($.parseJSON(response), function(item) {return { value: item.name, data: item.id };
                   })};}});});
</script>    

in Spring 
@RequestMapping(value = "/YOUR_URL", method = RequestMethod.GET)
public @ResponseBody List<TSRMaster> getTsrId(@RequestParam String tagName) {
    ----------
    return tsrMasterList;
}       

