Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

JSP Combobox and Java Class

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic