如何在html的td标记中传递Java变量值

时间:2012-11-16 09:39:44

标签: java html

String TC_Status =“PASS”;

如何在html

的td标记中传递TC_Status值“PASS”
  File f = new File("source.htm");
        BufferedWriter bw = new BufferedWriter(new FileWriter(f));
        bw.write("<html>");
        bw.write("<body>");
        bw.write("<table cellspacing="+50+">");
        bw.write("<tr>");
        bw.write("<td>S.No</td>");
        bw.write("<td>TestCaseDescription</td>");
        bw.write("<td>Status</td>");
        bw.write("<td>Screenshot</td>");
        bw.write("</tr>");

        bw.write("<tr>");
        bw.write("<td>1</td>");
        bw.write("<td>Login</td>");
        bw.write("<td></td>");     ---------------------------------- HERE PASS is to be displayed

        bw.write("<td></td>");      
        bw.write("</tr>");

        bw.write("</table>");
        bw.write("</body>");
        bw.write("</html>");
        bw.close();

请帮助完成这项工作

1 个答案:

答案 0 :(得分:1)

这应该有效

bw.write("<td>"+TC_Status+"</td>");