Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7769841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:15:30+00:00 2026-06-01T16:15:30+00:00

I have a jsp/html form that collects an array of choices from user. For

  • 0

I have a jsp/html form that collects an array of choices from user. For example, I ask “what did you like about this food?” and the user can add 1 answer per input field (with option to put in unlimited number of choices).
Here is what the html looks like:

<li><input type="text" name="choiceList[]" /></li>
<li><input type="text" name="choiceList[]" /></li>
<li><input type="text" name="choiceList[]" /></li>
<li><input type="text" name="choiceList[]" /></li>
<li><input type="text" name="choiceList[]" /></li>

…

In my backend (which is using Spring) I assign the choiceList array to a String[] choices java array.

My problem with this is that if somebody puts a comma separated list in one of the input fields (for example: apple, mango, orange”) and “pineapple” in another input field, the backed java array thinks the user input was 4 separate items (apple, mango, orange, pineapple) because the html form array choiceList[] is basically a comma separated list.

What do I need to do in my form so I can really tell that the user filled out only 2 input fields? To be clearer, I want my java array to be of size 2 not of size 4.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:15:32+00:00Added an answer on June 1, 2026 at 4:15 pm

    I basically had the same issue a while back and asked this question SO: How to prevent parameter binding from interpreting commas in Spring 3.0.5?

    The accepted answer will allow you to prevent Spring interpretting the commas in the users’ input.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my issue: I have a html form that after a user fills in
I have an html/jsp form that I am serializing(using jquery) and passing to a
I have a simple jsp form that the customer uses to send us emails.
Hello i have a JSP page that contain a form, i want to validate
I have a jsp that shows me a list of students from base. For
I have webpage with a form like this: <html> <head> ... </head> <body> <form
I would like to have a single JSP page that will do the following:
i have made a small web application with form.html output.jsp ServletOne.java In the form.html,users
I have a decent working web application (Java/Servlet/Jsp) that I would like to improve
I have a jsp page(let's say page1.jsp) which have an html form with action=page2.jsp.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.