编写一个JSP页面,输出九九乘法表
3个回答
2017-04-25
展开全部
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Jsp在页面上输出九九乘法表</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<%
StringBuffer sb = new StringBuffer();
for(int i = 1; i <= 9; i++){
for(int j = 1; j <= i; j++){
sb.append(j + "*" + i + "=");
sb.append(j*i);
sb.append(" ");
}
sb.append("<br>");
}
%>
<%=sb.toString()%>
</body>
</html>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Jsp在页面上输出九九乘法表</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<%
StringBuffer sb = new StringBuffer();
for(int i = 1; i <= 9; i++){
for(int j = 1; j <= i; j++){
sb.append(j + "*" + i + "=");
sb.append(j*i);
sb.append(" ");
}
sb.append("<br>");
}
%>
<%=sb.toString()%>
</body>
</html>
展开全部
<html >
<head>
</head>
<body>
<script language="javascript">
for (j=1;j<=9;j++){
for (i=1;i<=j;i++){
document.write(i+"*"+j+"="+i*j+" ")
if (i==2 && j<=4){
document.write(" ")}}
document.write("<br>")
}
</script>
</body>
</html>
文件名直接写?.jsp,放到服务器上,然后访问就可以了。
<head>
</head>
<body>
<script language="javascript">
for (j=1;j<=9;j++){
for (i=1;i<=j;i++){
document.write(i+"*"+j+"="+i*j+" ")
if (i==2 && j<=4){
document.write(" ")}}
document.write("<br>")
}
</script>
</body>
</html>
文件名直接写?.jsp,放到服务器上,然后访问就可以了。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询