File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSP Combobox and Java Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Combobox and Java Class" Watch "JSP Combobox and Java Class" New topic
Author

JSP Combobox and Java Class

Maya Naga
Ranch Hand

Joined: Nov 09, 2009
Posts: 79
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

Joined: Jan 10, 2002
Posts: 61413
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Maya Naga
Ranch Hand

Joined: Nov 09, 2009
Posts: 79
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

Joined: Jun 28, 2010
Posts: 91
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

Joined: Jan 10, 2002
Posts: 61413
    
  67

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP Combobox and Java Class