Febin Febin - 6 months ago 66
HTML Question

Datalist does not show values after space (not showing whole string value)

Using servlets, I am trying to get datalist from database. But datalist does not show the whole string value.
Example: "Computer Science" displayed as "Computer" in dayalist options. Values are displayed correctly in the console, Eg:"Computer Science"

out.println("<input list=\"dept12\" id=\"dept1\" > <datalist id=\"dept12\">");
Long key=(Long) itr.next();
out.println("<option value="+map.get(key)+" id="+key+">");


You did an mistake in this line:

out.println("<option  value="+map.get(key)+" id="+key+">");

I think it must be:

out.println("<option  value=\""+map.get(key)+"\" id=\""+key+"\">");