Results 1 to 2 of 2

Thread: AddAllAttributes method spring mvc

  1. #1
    Join Date
    May 2012
    Posts
    12

    Default AddAllAttributes method spring mvc

    I have two lists

    List<User> list_of_users=new ArrayList<User>();
    List<String> list_of_attributes=new ArrayList<String>();

    When i try to use the following lines of code:

    model.addAttribute("takeattributes",list_of_users) ;
    model.addAttribute("takeattributes",list_of_attrib utes);

    I realise that it keeps only the second list (list_of_attributes) and the first deleted. I was wondering how to keep both of these two lists in the model.Is this possible to be happened?Is the AddAllAttributes method what i need?If yes can anyone explain me how the AddAllAttributes method is working.I look at the spring mvc documentation but i didn't really understand.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    No it won't help you. You cannot store different collections under the same name, unless you first store them with different keys in a map but else you cannot... The Model is basically a glorified Map nothing more/nothing less.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

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