Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

display values from database into combobox using html and jsp  RSS feed

 
priya pillai
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends.

I just want to display the values in combobox from database using jsp,but i have difficulty in doing it can any one help me for this.I will be thankfull if any one gives me a code for the same.Also to retrieve an item from it.


I want to insert the value in str in the scriptlet into the combo box D9.

My program is


<%!
Vector v = new Vector();
String suppVal;

%>


[I][B]///To insert values into the compobox from the table supply compobox D9
<%
suppBean sb = new suppBean();
Vector v = new Vector();
v=sb.findAllsupp();
try
{
for(int i=0;i<v.size();i++)
suppVal =(String) (v.elementAt(i));
}catch(Exception e)
{
System.out.println("exception " + e);
}
Enumeration e=v.elements();
while(e.hasMoreElements())
{
String str=(String)e.nextElement();
//I want to inset str into the combo box D9
}
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A couple of things:

1) There's no such thing as a "combo box" on the web. That's a control only available in desktop applications. People will understand you better if you call it a dropdown or select element.

2) By using the <%! %> construct you have made your JSP non-thread-safe. This will cause many problems when the page is deployed and more than one person can display it at a time.

3) Is the issue that you do not know how to construct a <select> element in HTML?
 
priya pillai
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your replay...and valuable points..once angain thanks

Yes...I want to know how to insert values into the combobox.My values are inside the Vector v.I want to insert values in the vector into the combobox D9.

To get values we use getParameter...Like that for display the values in the vector what to do?

Priya
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear has the following advice

There's no such thing as a "combo box" on the web. That's a control only available in desktop applications. People will understand you better if you call it a dropdown or select element.


In your comment after this advice, you continue to use the wrong terminology.
Please follow the advice people give you when they are attempting to help you.
 
priya pillai
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you...and sorry...
 
Paul Clapham
Sheriff
Posts: 22502
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not start with an example of the HTML you want to generate? If you don't have that, then I can see how it would be difficult to write code that generates it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!