Febin Febin - 1 year ago 115
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+">");

Answer Source

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+"\">");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download