步骤一:打开eclipse;
步骤二:New->Dynamic Web Project;
步骤三:选中文件夹WebContent右键新建jsp文件;
步骤四:jsp内容如下:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>first jsp</title>
</head>
<body>
<h1>1+2+3+...+100 =?</h1>
<strong><span style="color:#3366ff;"><%
int sum = 0;
for(int i = 1;i<101;i++)
{
sum = sum+i;
}
int xxj = 100;
System.out.println("1+2+3+...+100 =" +sum);
out.println("IEoutput:1+2+3+...+100 =" +sum);
%>
<p>paragraph11+2+3+...+100=<%= sum %> </p>
<p>paragraph2:<%= xxj %> </p></span></strong>
</body>
</html>
<%这里面的是java小脚本%> <%=这是表达式%> 里面的%和=必须紧邻