【发布时间】:2021-04-04 02:08:25
【问题描述】:
对于 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/Project-SNAPSHOT/loanDisbursalForm
我尝试将获取映射值更改为 -"/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.
【问题讨论】:
标签: javascript java jquery jsp controller