zoukankan      html  css  js  c++  java
  • 3.8web网页设计的一篇作业

    我今天学习了如何从一个网页跳转到另一个网页,首先我做了第一个页面Homework,在这个页面运行后会出现一个输入数字的文本框,再点击提交后,会跳转到另一个页面并比较与你指定数比较大小

    第一个网页:Homework

    <%@ 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 'homework.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>

        <form name="forml"method="post"action="answer.jsp">

         数字:

         <label>

            <input type="test" name="number"id="textfield">

            <br>

            <input type="submit"name="button"id="button"value="提交">

         </label>

        </form>

      </body>

    </html>

    第二个网页:Answer

    <%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>

    <%

    String path = request.getContextPath();

    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

    %>

    <%String Num  ; %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>

      <head>

        <base href="<%=basePath%>">

        

        <title>My JSP 'answer.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>

        

        <% Num = request.getParameter("number"); %>

        <%

        Integer.valueOf(Num);

        if(Integer.valueOf(Num)>=10) {

            %>

            <%=+Integer.valueOf(Num)+">=10" %>

            <%

         }else{

             %>

            <%=+Integer.valueOf(Num)+"<10" %>

            <%

            }

          %>

      </body>

    </html>

     下面附赠几张截图:

  • 相关阅读:
    《maven实战》笔记(5)----maven的版本
    《maven实战》笔记(4)----maven的仓库
    《maven实战》笔记(2)----一个简单maven项目的搭建,测试和打包
    《maven实战》笔记(1)----maven的初识
    web项目jsp出现The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path错误
    如何在国内使用google
    js实现仿购物车加减效果
    关于行内元素之间有空隙的问题,例如span与input之间
    jquery遍历DOM方法总结
    左侧手风琴下拉菜单导航(网页常用功能)
  • 原文地址:https://www.cnblogs.com/bgd150809229/p/6523927.html
Copyright © 2011-2022 走看看