package web01;import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloServlet02 extends HttpServlet{
public void service(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException{
//讀取請(qǐng)求參數(shù)值
//String width=request.getParameter("width");
//String height=request.getParameter("height");
//處理
// time="2015.10.13 16:27";
// double a=Double.parseDouble(width);
// double b=Double.parseDouble(height);
// double c =a/b/b;
String greeting="";
int a=0;
for (int i = 0; i < 10; i++) {
String d="";
for (int j = 1; j <= i; j++) {
String c="("+i+"*"+j+"="+(i*j)+") ";
d+=c;
}
greeting +="<span><p>"+d+"</p></span>";
}
//設(shè)置服務(wù)器返回的數(shù)據(jù)類型
response.setContentType("text/html");
PrintWriter out =response.getWriter();
out.println(greeting);
out.close();
}
}