<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%@page import="java.text.*" %>
<%@page import="java.lang.String" %>
<%
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>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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<!-- 我是html注释,可在客户端看见 -->
<%--我是JSp注释,在客户端不可见 --%>
<% /*我是脚步注释*/
%>
<h1>九九乘法表</h1>
<hr>
<%!//定义自定义变量或方法
String fangfa(){
String s="";
for(int i=1;i<=9;i++){
for(int j=1;j<=i;j++){
int c=i*j;
s=i+"*"+j+"="+c;
}
s=s+"<br>";
}
return s;
}
%>
<%
SimpleDateFormat date=new SimpleDateFormat("yyyy/MM/dd");
String d =date.format(new Date());
%>
今天是:<%=d %>+"<br>"
<%=fangfa()%>
</body>
</html>但效果是这样,求大神指点哪里问题要求:http://www.imooc.com/qadetail/179761
添加回答
举报
0/150
提交
取消