JSP页面输出九九乘法表--JSP基础

index.jsp:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML>
<html>
<head>
<title>My JSP 'index.jsp' starting page</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>
<%
String str="";
for(int i=1;i<=9;i++){
for(int j=1;j<=i;j++){
str+=j+"x"+i+"="+j*i+"&nbsp;&nbsp;";
}
str+="<br>";
}
%>
<div>
<%=str%>
</div>
</body>
</html>

示例效果图:

相关文章
相关标签/搜索