• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Combobox and Java Class

 
Maya Naga
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranches,
I have developed an application with the combination of html, JSP and Servlet...
i have created a jsp file with 3 combo box....
for first 2 combo boxes am passing value from database..
but for the third combo i need to pass array values from a java file...

the code is as follows:


i need to pass these values to :



How to do that? please i need help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ambika Nagalakshmi wrote:i have created a jsp file with 3 combo box

Actually, you haven't. Part of professional programming is using the proper terminology. There is no such thing as a "combobox" on the web. Please see HtmlHasNoComboBox for more information.

How to do that?

Set the array data as a scoped value in the request in the controller. Then in the JSP, use the EL and the JSTL <c:forEach> tag to iterate over the array and create the option elements.
 
Maya Naga
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear.. actually it was my mistake to mention as combo box..
Am new to JSP and Servlet..
Please can you give me some example...
 
dileep keely
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set the array data as a scoped value in the request in the controller.
or
or

Then in the JSP, use the EL and the JSTL <c:forEach> tag to iterate over the array and create the option elements.

Just my thoughts !!!
<EDIT 1:image wasn't displayed properly>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But just remember that Java code and Java scriptlets should never be used in a JSP. Ever. That's a a very bad practice that has been discredited for over 8 years now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic