?
Solved

JSP and listbox~~

Posted on 2003-02-25
16
Medium Priority
?
350 Views
Last Modified: 2010-05-18
I am trying to get all the data in a listbox and am not sure how to go about doing this...i tried using request.getParameter("listboxname") but it only gets the item that was selected...but i want to get all the items in the box...any suggestion will be helpful :D
0
Comment
Question by:newbieME
  • 8
  • 7
16 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 8019461
What kind of form element is it - i.e. how is it specified in the form?
0
 

Author Comment

by:newbieME
ID: 8019491
<FORM NAME = "viewDetail" action="update.jsp?ID=<%= prjID %>" method="post">
<select name ="assignedList" size = "8" STYLE="width:150;" >

...and some jsp code for listing options....
does this help?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8019549
Did you try

String[] elements = request.getParameterValues("assignedList");

?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:newbieME
ID: 8019613
oops i tried request.getParameter..not parameterValues..hehe but um..
String[] assignedMem = request.getParameterValues("assignedList");
for(int i = 0; i < assignedMem.length; i++)
out.println(assignedMem[i]);

this code should work..in order to access the elements right?
0
 

Author Comment

by:newbieME
ID: 8019632
yeah i seem to be getting Null values....
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8019660
Well, was anything selected? You will do if nothing was
0
 

Author Comment

by:newbieME
ID: 8019676
yeah nothing was..i am trying to get all the items in the listbox whether they are selected or not..
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8019691
And when something is...?
0
 

Author Comment

by:newbieME
ID: 8019764
hehe all right..
i have a listbox which lists people assigned to a specific project...now when the user clicks on the submit button on the form, it will go to update.jsp where i am going to try to get all the items that were in the listbox and stick them to a database.

So nothing has to be selected in the listbox..just list stuff...is that even possible? to get items that are not selected in the list box?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8019796
I'm not sure why you'd want them if none had been selected, but you've already got them - it was you who put them there in the first place surely?
0
 

Author Comment

by:newbieME
ID: 8019873
well the thing is, the listbox lists people who are assigned to a project, and i have another listbox which lists people who are available to be assigned. i have these "<" and ">" buttons and user can use that to move an item from one listbox to another, therefore assigning/removing a person from the project.

And finally when the user clicks on Update button, it will go to update.jsp and update the database by adding in new people that appeared on the list and removing the ones that dissapeared......i hope i am being clear enough...i just started doing programming few days ago..and all these jsp and database stuff are new to me :|
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8020175
Yes, i follow you i think. The thing is that you're going to be generating the lists in the first place (you'll have to in order to cope with the changes) so you already know who's in each list.
0
 

Author Comment

by:newbieME
ID: 8028119
yeah nevermind..i got it figured out...though it's not very efficient i can't seem to find any other way to do it....if anyone is having the same problem as i am tell me and i will post the code
0
 

Author Comment

by:newbieME
ID: 8034533
I am going to get this question to be removed and if there are no objections :D
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8036395
Well, OK then.
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 8074765
Points refunded and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question