2
我是新來的Twitter Typeahead(typeahead.js 0.11.1),我試圖用Thymeleaf + Spring MVC使用遠程選項來配置它。Twitter Typeahead Bloodhound遠程Spring MVC字符解碼失敗
這裏是我的控制器類:
@Controller
public class AutocompleteController {
@Autowired
private IRefDataService refDataService;
@RequestMapping(value = "/get_user_firstname_suggestions.json", method = RequestMethod.GET)
public @ResponseBody List<String> getUserFirstNameSuggestions(@RequestParam("searchTerm") String searchTerm) {
return refDataService.getUserFirstNameSuggestions(searchTerm);
}
}
這裏是我的javascript代碼:
// constructs the suggestion engine
var firstNames = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote:{
url: "/hub/get_user_firstname_suggestions.json?searchTerm=%QUERY"
}
});
//Initialize the Bloodhound suggestion engine
firstNames.initialize();
$([[${'#' + heading.fieldName}]]).typeahead({
hint: true,
highlight: true,
minLength: 2
},
{
name: 'firstNames',
display: 'value',
source: firstNames.ttAdapter()
});
當我嘗試運行我的申請,我收到以下消息:
INFO: Character decoding failed. Parameter [searchTerm] with value [%QUERY] has been ignored. Note that the name and value quoted here may be corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.
Note: further occurrences of Parameter errors will be logged at DEBUG level.
任何想法如何解決這個問題?