Solved

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

Posted on 2004-03-25
11
171 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
  • 6
  • 3
11 Comments
 
LVL 30

Expert Comment

by:mayankeagle
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:mayankeagle
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
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10685897
Bad code. I forgot a </OPTION> tag everywhere.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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:mayankeagle
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:
mayankeagle 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:mayankeagle
ID: 10983555
Please proceed with that recommendation.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now