12

I want to use JQuery's Sortable (http://jqueryui.com/sortable/#connect-lists), so my left list will end with something like this

<ul>
    <li>
        Some txt1 
        <input type="hidden" name="li1" value="1"/>
    </li>
    <li>
        Some txt2 
        <input type="hidden" name="li2" value="2"/>
    </li>
</ul>

The number of <li> will be different every time. My idea is to get all hidden inputs values and names put them in array and POST the array as JSON data, but how should my Controller look like? Is there a way to "wait" for list of something in the controller. For example:

@RequestMapping(value = "/listItems")
    public @ResponseBody GridModel getUsersForGrid(@RequestParam(value = "items") List<NameIdPair> items){...}

1 Answer 1

15

you can inject a instance of Map holding all parameters.

@RequestMapping("/listItems")
public @ResponseBody GridModel getUsersForGrid(@RequestParam Map<String, String> params) {
    params.get("parametername");
    // ...
}
Sign up to request clarification or add additional context in comments.

1 Comment

How does that look in Chrome in the http field when you enter an address?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.