Results 1 to 6 of 6
- 05-15-2008, 08:16 AM #1
Member
- Join Date
- May 2008
- Posts
- 14
- Rep Power
- 0
- 05-15-2008, 09:17 AM #2
Senior Member
- Join Date
- May 2008
- Location
- Makati, Philippines
- Posts
- 234
- Rep Power
- 6
HTML are not that Dynamic so you must be Creative to make it look Dynamic. YOu can use Javascript or Ajax to do it. But i dont know that yet. So here is my solution using only JSP and Servlet.
In your Servlet you should have this code
wherein OptionFromServlet is a String that you will be passing from Servlet to the JSP
In your Servlet you have thisJava Code:<select Type="ComboBox" name="drop"> <%=OptionFromServlet> </select>
The only problem with this is when the page is loaded the combox is null. You have to put a refresh, to Load the data from the Servlet to the JSP. =PJava Code:String Temp[] = {"One","Two","Three"}; //here is where your list is String OptionToJSP=null; Int ctr = Temp.length(); for(int i=0; i<ctr; i++){ OptionToJSP += "<OPTION>" + Temp[i] + "</OPTION>"; } OptionToJSP = OptionToJSP.substring(4); //Then Return OptionToJSP to the JSP. . .
I Hope that HelpsMind only knows what lies near the heart, it alone sees the depth of the soul.
- 05-15-2008, 10:03 AM #3
Member
- Join Date
- May 2008
- Posts
- 14
- Rep Power
- 0
i want to load data into the combo box without clicking any button.daata should be there when the page is loaded.hw can i do that??
- 05-15-2008, 10:25 AM #4
Senior Member
- Join Date
- May 2008
- Location
- Makati, Philippines
- Posts
- 234
- Rep Power
- 6
Im still a noob in J2EE, lets wait for the experts to answer your question. =)
Mind only knows what lies near the heart, it alone sees the depth of the soul.
- 05-15-2008, 12:26 PM #5
in your jSP
is that ookay, or should i write the code for fill_my_combo_box as well :DJava Code:<script> window.onLoad = init(); function init(){ fill_my_combo_box( myComboBoxID, listOrMapOfValuesToPopulate); } </script>i am the future
- 05-15-2008, 12:57 PM #6
Member
- Join Date
- May 2008
- Posts
- 14
- Rep Power
- 0
Similar Threads
-
[SOLVED] Adding ComboBox
By impact in forum New To JavaReplies: 2Last Post: 05-02-2008, 08:43 PM -
How to display Tabuler Data in J2EE application on jsp page
By AMATYA-CHANAKYA in forum Advanced JavaReplies: 2Last Post: 04-23-2008, 05:54 PM -
HashMap and ComboBox
By banie in forum AWT / SwingReplies: 2Last Post: 03-25-2008, 11:58 PM -
how to load a servlet on index.jsp page...
By sujithc34 in forum Java ServletReplies: 1Last Post: 01-19-2008, 12:28 AM -
ComboBox with database options
By Goldy in forum Advanced JavaReplies: 0Last Post: 12-01-2007, 09:43 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks