View Single Post
  #2 (permalink)  
Old 05-15-2008, 10:17 AM
Eku Eku is offline
Senior Member
 
Join Date: May 2008
Location: Makati, Philippines
Posts: 199
Eku is on a distinguished road
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
Code:
<select Type="ComboBox" name="drop"> <%=OptionFromServlet> </select>
In your Servlet you have this
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. . .
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. =P

I Hope that Helps
__________________
Mind only knows what lies near the heart, it alone sees the depth of the soul.
Reply With Quote