zoukankan      html  css  js  c++  java
  • JSP页面获取

    截图:

    main代码:

    <%@ 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 'main.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>
        <jsp:include page="circle.jsp">
            <jsp:param value="3" name="R"/>
        </jsp:include>
     <jsp:include page="ladder.jsp">
            <jsp:param value="2" name="Upb"/>
            <jsp:param value="4" name="Downb"/>
            <jsp:param value="5" name="H"/>
        </jsp:include>
      </body>
    </html>
    

    circle代码:

    <%@ 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 'circle.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>
           <%
                   String r= request.getParameter("R");
                   int R= Integer.parseInt(r);
                   out.println("圆的半径是:"+r+"			面积是:"+Math.PI*R*R);
           %>
            
      </body>
    </html>

    ladder代码:

    <%@ 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 'ladder.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>
         <%
            String Up = request.getParameter("Upb");
            String Down = request.getParameter("Downb");
            String H = request.getParameter("H");
            int upB = Integer.parseInt(Up);
            int downB = Integer.parseInt(Down);
            int h = Integer.parseInt(H);
            out.println("梯形的上底为:" + Up + ",下底为:" + Down + ",高为:" + H);
            out.print("梯形的面积为:" + ((upB + downB) * h) / 2);
        %>
      </body>
    </html>
  • 相关阅读:
    hdoj 1305字典树水题之二
    nyoj 547 水池加水 priority_queue优先级队列初体验
    nyoj167 找奶牛病毒 “按位或”运算 递归
    HDOJ4525 吃鸡腿 腾讯马拉松(五)
    hdoj 4523 切蛋糕 腾讯马拉松 大数加法比较
    如何学好3D游戏引擎编程《转自3D游戏引擎网》
    priority_queue 优先级队列的基本应用和重载问题
    poj1611 传染病 并查集
    srand((unsigned)time(NULL))和rand()
    最近被一个windows mobile照相的问题给难住了
  • 原文地址:https://www.cnblogs.com/XiaoPoHai-11/p/12561482.html
Copyright © 2011-2022 走看看