get 404找不到jquery autocomplete

smdnsysy  于 2021-06-29  发布在  Java
关注(0)|答案(1)|浏览(274)

对于jsp上的输入-我想显示与输入相关的建议。
我的控制器-

@GetMapping(value = "/customerAutoComplete")
    @ResponseBody
    public List<String> customerAutoComplete(@RequestParam(value = "term",
            required = true, defaultValue = "") String term){
        List<String> ls=new ArrayList<String>();
        ls.add("L110");
        ls.add("L111");
        ls.add("L011");
        return ls;

    }

jsp页-

<script type="text/javascript">
        $(function() {
            $("#customerCode").autocomplete({
                source: "/customerAutoComplete",
                minLength:2
             });
         });
</script>
//input somewhere in the file-
<div class="form-group">
     <label for="customerCode" class="font-weight-bold ">Customer#</label>
     <input type="text" class="form-control" name="customerCode" id="customerCode" required oninput="customerf()"/>
</div>

我现在在-http://127.0.0.1:8080/项目快照/loandisbursalform
我尝试将getMap值更改为-“/loandisbusralform/customerautocomplete”,但仍然没有成功。
精确误差-

jquery-3.5.1.js:10099 GET http://127.0.0.1:8080/customerAutoComplete?term=L1 404 (Not Found)

注意-当我加载贷款支付形式,我也得到了这个错误不知道它有一些与它或没有联系-

Refused to apply style from 'http://127.0.0.1:8080/Project-SNAPSHOT/styles.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
cu6pst1q

cu6pst1q1#

使用正确版本的jquery,特别是jqueryui解决了这个问题。

相关问题