aspose file tools*
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 Spring in Action this week in the Spring 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?