Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use for loop inside of dropdownlist at jsp?

 
ronney singh
Ranch Hand
Posts: 40
IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Piyush Joshi
Ranch Hand
Posts: 207
Eclipse IDE Firefox Browser jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a really bad practice to use scriptlets in JSP.
Use jstl tags. especially foreach tag will help you most in this case.
 
Nam Ha Minh
Ranch Hand
Posts: 504
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use JSTL's <foreach> tag instead, it is easy to use and flexible. For example:

 
ronney singh
Ranch Hand
Posts: 40
IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your support.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic