zoukankan      html  css  js  c++  java
  • JSP第一周作业

    <%@ 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>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>
        我的第一个页面
        <br>
    </body>
    </html>
    编写jsp页面,计算1-100之间所有素数和
    <%@ 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>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>
        我的第一个页面
        <br>
        <%
            int s, count = 0;
            for (int i = 2; i <= 100; i++) {
                for (s = 2; s < i; s++) {
                    if (i % s == 0)
                        break;
                }
                if (s == i)
                    count += s;
     
            }
            out.print(count);
        %>
    </body>
    </html>
    <%@ 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>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>
        我的第一个页面
        <br>
        <%
            int s, count = 0;
            for (int i = 2; i <= 100; i++) {
                for (s = 2; s < i; s++) {
                    if (i % s == 0)
                        break;
                }
                if (s == i)
                    count += s;
     
            }
            out.print(count);
        %>
    </body>
    </html>

  • 相关阅读:
    Linux基础之-正则表达式(grep,sed,awk)
    Linux基础之-利用shell脚本实现自动监控系统服务
    Linux基础之-网络配置,主机名设置,ssh登陆,scp传输
    Linux基础之-Bash命令优先级
    Linux基础之命令练习Day7-nginx,nfs
    Linux基础之命令练习Day4-fdisk,mkfs,mlabel,mount,umount,mkswap,swapon,dd,top,free,ps,kill,rpm,yum,make
    Linux基础之命令练习Day3-文件管理:cat,tar,gzip,vim,ln
    Linux基础之命令练习Day2-useradd(mod,del),groupadd(mod,del),chmod,chown,
    按二次返回键退出
    注册用户倒计时
  • 原文地址:https://www.cnblogs.com/1774ax/p/14505452.html
Copyright © 2011-2022 走看看