• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting elements from a list box

 
naro pad
Ranch Hand
Posts: 58
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form which the user enter some data into text fields and submit the form. After submitting I have a jsp page where I have use some beans and I save the objects into database.

Now I have insert the following mechanism(in Javascript):
I have 2 list box.The first one contains all the subjects.If the user select one subject and click on the button add the subject is remove and added to the other list box(let called it Prerequisite).
Now how can I get that values from the "Prerequisite" list box and save them. With request.getParameter surely you can't

I hope you understand me what I'm trying to do...
Any help?

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two approaches come to mind:

1) In the form's submit handler, cause all the list's elements to be selected. That way, they'll all be submitted as the list's value. Be sure that the list is set to be multiple.

2) In the form's submit handler, create hidden elements for each entry in the list.

Approach (1) is probably easier, but the 'flash' as the list elements are selected just before submission could be annoying.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic