Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing selected values from list to another window which is a jsp

Posted on 2004-03-25
11
Medium Priority
?
179 Views
Last Modified: 2010-04-17
hi , my requirement is
i got one select option list with multiple values in one jsp . I have to select more than one values from the list and pass those values to the pop up window and populate them in a table in order to display those selected values in pop up window which  is an another jsp.
please send me code how can i do this using jsp and javascript.

Sai.
0
Comment
Question by:MaheshJ
[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
  • 6
  • 3
11 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 10675652
if you want to select multiple values, then it would not be an 'option' list.
0
 

Author Comment

by:MaheshJ
ID: 10685782
what i mean to say is there is a list box which contains multiple items in that. Iam required to select multiple items from that list using ctrl button. now i need to pass these all selected values to next jsp , where in i populate these values and fill in table dynamically.

Sai
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10685895
Sure you can:

<SELECT MULTIPLE SIZE=5>
 <OPTION VALUE="o1">Option 1
 <OPTION VALUE="o2">Option 2
 <OPTION VALUE="o3">Option 3
 <OPTION VALUE="o4">Option 4
 <OPTION VALUE="o5">Option 5
 <OPTION VALUE="o6">Option 6
</SELECT>

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 30

Expert Comment

by:Mayank S
ID: 10685897
Bad code. I forgot a </OPTION> tag everywhere.
0
 

Author Comment

by:MaheshJ
ID: 10702369
what u have suggested to not suited for the requirement. With the above code we can select multiple values , ok , but what i need to do is all the selected values from above option list must be passed to next JSP. So how can we pass all the selected values from option list to next JSP ?
 
Sai
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10702399
Set it as parameters or an attribute of the request object, or the session. Something like:

String sValues[] ....
// -> the array contains all the selected values from the list

request.setAttribute ( "SelectedValues", sValues ) ;

In the other JSP, use:

String[] sValues = ( String [] ) request.getAttribute ( "SelectedValues" ) ;

- and display the contents of the String array.
0
 

Author Comment

by:MaheshJ
ID: 10731279
ok u said that to set it as parameter or attribute. now in current jsp to get the selected values in the list i have to go for javascript and how can i fill sValues[] and set it as parameter or attribute ?
I am getting selected values using javascript and im not able to get those selected values using java in jsp.
thanks for ur help please suggest me how can i get the selected list in jsp with out using javascript so that i can set as parameter.

sai
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 200 total points
ID: 10731371
If you have the values in a list, then you should just forward the request (it will automatically have the parameters of the form which was submitted). You can use request.getParameter ( "list_name" ) ; to get the selected value.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10983555
Please proceed with that recommendation.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Progress

722 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