?
Solved

JSP and listbox~~

Posted on 2003-02-25
16
Medium Priority
?
343 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

801 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