html <select> in jsp
out.println("<td><select> <option value ="volvo">Volvo</option> <option value ="saab">Saab</option></select></td>");
Hi,
I am trying to print a select html with the println method, but when executed I get this error:
')' expected
what do i have to change to make it work?
thanks...
[470 byte] By [
deroka] at [2007-11-27 9:04:48]

# 1
The highlighting in the above example should give you a hint.
You use quotes " to mark the beginning and end of a string.
You have some in the middle.
Either escape them with \", or use single quotes around the html values to get it to work.
out.println("<td><select> <option value =\"volvo\">Volvo</option> <option value =\"saab\">Saab</option></select></td>");
// or
out.println("<td><select> <option value ='volvo'>Volvo</option> <option value ='saab'>Saab</option></select></td>");
Why are you using out.println with html anyway?
Why is this not just template text in a JSP? Then there wouldn't be an issue.