Resen4983
2017-03-22 18:38
<%@ page language="java" contentType="text/html; charset=utf-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>MultiplicationTable</title> </head> <body> <%! //通过表达式调用返回九九乘法表 String PrintMultiTable1(){ String s=""; for(int i=1;i<=9;i++){ for(int j=1;j<=i;j++){ s+= i+"*"+j+"="+(i*j)+" "; } s+="<br>";//追加换行标签 } return s; } //使用脚本方式调用,打印九九乘法表 void PrintMultiTable2(JspWrite out) throws Exception { for(int i=1;i<=9;i++){ for(int j=1;j<=i;j++){ out.println(i+"*"+j+"="+(i*j)+" "); } out.println("<br>");//追加换行标签 } } %> <h2>乘法表</h2> <hr> <%=PrintMultiTable1() %> ]<hr> <% PrintMultiTable2(out); %>] </body> </html>
不是JspWrite,是JspWriter
参数应为:JspWriter out 你少了个 -->r
JAVA遇见HTML——JSP篇
248278 学习 · 3071 问题
相似问题