0

ユーザーがドロップダウン メニューから項目をクリックすると、Web ビューに複数の HTML コンポーネントが表示されます。ビューに配置する必要があるものは次のとおりです。

1. A JSON object which include a large array of data for autocomplete dropdown menu
2. Some other pojo collections for regular html component values.

次のSpring MVCコントローラーメソッドを使用する場合:

@RequestMapping(value="{name}", method = RequestMethod.GET)
public @ResponseBody Shop getShopInJSON(@PathVariable String hotelName) {

    List<Hotel> hotels = getHotelByNameLike(hotelName);

    return hotels;

}

そして、他のpojoオブジェクトを次のように追加しますModelAttribute

@ModelAttribute("someName")
public Collection<SomeObject> populateObject() {
    return Object.getAllObjects();
}

上記の計画に関するいくつかの質問は次のとおりです。

1. There are two solution regarding `autocomplete`
    a. Each time user type in inputbox, generate a new `Like`query to getch similar results
    b. Use JSON to load all data to the view and let javascript to filter out the data in the memory. 
Plan be is preferred, but how can above code implement plan b?

2. Above code fails to mention `view` name which responds to the request from menu event.
3. Can above solution work out to bring both JSON object and POJO object to the same view?
4

0 に答える 0