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.

evnafetsa at 2007-7-12 21:38:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
> 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.I'm just testing some things.thanks a lot.
deroka at 2007-7-12 21:38:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...