Solved

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

Posted on 2004-03-25
11
177 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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 50 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Starting up a Project

628 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