首页 > 代码库 > 邂逅 JSP

邂逅 JSP



技术分享

<%@ page contentType="text/html;charset=UTF-8"%><!-- 字符编码为utf-8,不然会乱码。。。。 --><%@ page import="java.util.Date"%><%!Date date; public int continueSum(int start, int end) { int sum = 0; for (int i = start; i <= end; i++) sum += i; return sum; }%><html><head><title>first blood</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><!-- head中间要加这句话,不然会乱码 --></head><body> <font size=4><p> 程序片创建Date对象: <% date = new Date(); out.println("<BR>" + date); int start = 1; int end = 100; int sum = continueSum(start, end); %> <br><%=start%><%=end%> 的连续和是 <%=sum%></font></body></html>

 技术分享

<%@ page contentType="text/html;charset=gb2312"%><html><head><title>first blood</title></head><body bgcolor=yellow>    <font size=3> <%!int i = 0;%> <%     i++; %>        <p>            您是第            <%=i%>            个访问本站的用户.</body></html>

 

邂逅 JSP