my dog learned polymorphism*
The moose likes JSP and the fly likes How to use for loop inside of dropdownlist at jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to use for loop inside of dropdownlist at jsp? " Watch "How to use for loop inside of dropdownlist at jsp? " New topic
Author

How to use for loop inside of dropdownlist at jsp?

ronney singh
Ranch Hand

Joined: Feb 10, 2012
Posts: 40

I am sending an arraylist of names through servlet to success.jsp page and want to put all names in the dropdownlist at success.jsp.
I am trying to use for loop here using scriplets but haven't succeed.



This code is only showing last name of arraylist in the dropdownlist of this jsp page.
Please tell me the best method to do it.


Live Life King Size
Piyush Joshi
Ranch Hand

Joined: Jun 10, 2011
Posts: 207

Its a really bad practice to use scriptlets in JSP.
Use jstl tags. especially foreach tag will help you most in this case.


Piyush
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

use JSTL's <foreach> tag instead, it is easy to use and flexible. For example:



PM Me If You Want to get Urgent Help on Java Programming
ronney singh
Ranch Hand

Joined: Feb 10, 2012
Posts: 40

Thank you very much for your support.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use for loop inside of dropdownlist at jsp?
 
Similar Threads
getting this Ajax code to work with jsp
correct Ajax script syntax for second DropDown
how to preselect value in dropdownlist in jsp struts
How to implement following Code
How to get default value to my dropdown list