Home Java - Pass multiple parameters to ajax post
Reply: 1

Java - Pass multiple parameters to ajax post

fsdf
1#
fsdf Published in 2018-01-12 13:16:17Z

I have this simple controller from ajax request. It works but I wanted to return many stuff, not only List TestFlow.getFlow(flowName);

 @RequestMapping(value = "/execute-flow/getFlow" , method = RequestMethod.POST)
public @ResponseBody List<String> getFlow(@RequestParam("flowName") String flowName) {
    return TestFlow.getFlow(flowName);
}

Can I return multiple things to the ajax post?

For example:

 @RequestMapping(value = "/execute-flow/getFlow" , method = RequestMethod.POST)
public @ResponseBody List<String> getFlow(@RequestParam("flowName") String flowName) {
    return TestFlow.getFlow(flowName);
    return TestFlow.getInputs(flowName);
    return TestFlow.getCode(flowName);
}
SeverityOne
2#
SeverityOne Reply to 2018-01-12 14:24:31Z

Not sure what exactly you're after, but

return Arrays.asList(
        TestFlow.getFlow(flowName),
        TestFlow.getInputs(flowName),
        TestFlow.getCode(flowName));

should work, provided that all of these are of the same type (String).

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305721 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO