#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Location
    UK
    Posts
    10
    Rep Power
    0

    Multiple select list values


    I know I can do this in PHP, it must be possible using JSP but I'm new to it.

    I'd like to take the multiple values of a SELECT list in a form and process them. Using PHP I would set the SELECT NAME to be an array and process the array. I tried this in some JSP but it didn't work. I am trying to use request.getParameter("selectname") but the compiler tells me I can only use a string with it.

    Someone out there is bound to know the answer.
  2. #2
  3. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    Unlike PHP, you don't use the square brackets in the name of the field ([]), just use a normal field name. However, when you go to retrieve the values, use the method request.getParameterValues(String) instead of getParameter(String). request.getParameterValues(String) returns an array of Strings.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Location
    UK
    Posts
    10
    Rep Power
    0
    Excellent Nemi! Thank you VERY much. I have had all sorts of wild goose chase help on this one from people but your getParameterValues tip is spot on.

    Thanks again.

IMN logo majestic logo threadwatch logo seochat tools logo