Results 1 to 3 of 3

Thread: Spring 3 - Restful - passing ArrayList<object> to the controller

  1. #1
    Join Date
    Sep 2010
    Location
    Chicago
    Posts
    11

    Default Spring 3 - Restful - passing ArrayList<object> to the controller

    Hi,

    I am using RESTful web service to make a call to my controller and I need to pass in an ArrayList<Product> that's been populated in a hidden field the jsp.

    @RequestMapping(value = "/find", method = POST)
    public ModelAndView displayMyProductsXXX(@RequestParam("products") ArrayList productList) throws IOException {
    .
    .
    .
    }

    I tried @ModelAttribute and it didn't work. So far the @RequestParam ("products") ArrayList productList returns a list of products but the type is String instead of Product

    Can anyone please help me to find out the best way to implement this?

    Thanks

  2. #2
    Join Date
    Oct 2005
    Location
    Mobile, AL
    Posts
    345

    Default

    Have you setup a custom converter to convert the string into your Product object.

    Here is a article that will explain what you need.

  3. #3
    Join Date
    Sep 2010
    Location
    Chicago
    Posts
    11

    Default

    @MartyJones

    Hi, sorry for the late reply. Yes I have the converter, but unable to receive a parameter in a form of list or array from the jsp.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •