Dynamic values in checkbox

Hello,

I have a servlet where I submit the value of check box to other servlet and print them there.

out.println("<input type=\"checkbox\" name=\"option2\" value=\"2\" checked>");

out.println(word+"

");

for this check box no problem as the value is static and always =2

I tryed to make the vlaue dynamic value ="string"

out.println("<input type=\"checkbox\" name=\"option1\" value=\"<%=word%>\" checked>");

out.println(word+"

");

but when i print this i got :

2 null

any help

[574 byte] By [farag_ahmed@yahoo.coma] at [2007-11-27 8:50:56]
# 1

Hi, please use the 'code' tags; select the text and click the code button when you're posting, it makes things easier to read.

1. Since you're getting null, that means the value in the variable 'word' is null; check where the value should be assigned.

2. Your code for printing the value of 'word' is wrong; why're you using the JSP tags ( <%= %> ) when it's a servlet?

String word ="This Value" ;

out.println("<input type=\"checkbox\" name=\"option1\" value=\"" + word + "\" checked>");

nogoodatcodinga at 2007-7-12 21:03:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Dear ,thanks a lot , it works fine :)Faraj
farag_ahmed@yahoo.coma at 2007-7-12 21:03:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...