• 我的JSP的HelloWorld


    在4317机房,跟着小海写下第一个JSP。

    <%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
    <%
    	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 'a.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>
    		<%
    			double r, s;
    			String radius = request.getParameter("radius");
    			if (radius == null)
    				s = 0;
    			else {
    				r = Double.parseDouble(radius);
    				s = 3.14159*r*r;
    			}
    		%>
    		<font size=6 color=red>圆面积计算</font>
    		<form action="" method="post" name=f1>
    			请输入半径
    			<input type=text name=radius value="0" size=5 />
    			面积=
    			<input type=text name=area value="0" size=5 />
    			<input type="submit" value="计算" />
    		</form>
    	</body>
    </html>
    <script language="javascript">
    document.f1.area.value="<%=s%>";
    document.f1.radius.value="<%=radius%>";
    </script>
    
  • 相关阅读:
    leetcode44:wildcard
    Python实现决策树
    PCA实现
    js触摸事件
    js中的getBoundingClientRect()函数
    Java中timer的schedule()和schedualAtFixedRate()函数的区别
    nodejs中的exports和module.exports
    为什么MySQL数据库要用B+树存储索引
    浅谈微服务中的熔断,限流,降级
    缓存击穿、缓存穿透和缓存雪崩
  • 原文地址:https://www.cnblogs.com/jentle/p/3579330.html
Copyright © 2020-2023  润新知