其他分享
首页 > 其他分享> > jsp5

jsp5

作者:互联网

 11.任务一、教材P39实验3

<html> 2 <head> 3 <title>My JSP 'audio.jsp' starting page</title> 4 </head> 5 6 <body bgcolor=pink> 7 <embed src="english/english.mp3" autostart=false> 8 课文音频 9 10 11 12 </body> 13 </html>
 1 <html>
 2 <head>
 3 <title>My JSP 'index.jsp' starting page</title>
 4 <meta charset = "utf-8">
 5 </head>
 6 
 7 <body bgcolor = cyan>
 8 <br>英文课文(English Text):
 9     <p style="font-family:宋体;font-size:18;color:black">
10     <jsp:include page="english/english.txt"></jsp:include>
11     <br>课文音频(English Audio):
12     <jsp:include page="audio.jsp"></jsp:include>
13     </p>
14     
15 </body>
16 </html>

2.任务二、教材P45  8题

 

 1 <body>
 2     <jsp:include page="audio.jsp">
 3     <jsp:param value="5" name="r"/>
 4     </jsp:include>
 5     <jsp:include page="lin.jsp">
 6     <jsp:param value="4" name="h"/>
 7     <jsp:param value="6" name="sd"/>
 8     <jsp:param value="3" name="xd"/>
 9     </jsp:include>
10   </body>
1 <body>
2     <%
3         double r = request.getParameter("r") == null ? 0 : Double
4                 .parseDouble(request.getParameter("r"));
5         double area = 3.14 * r * r;
6         out.print("圆的半径为:" + r + "</br>面积为:" + area);
7         out.print("</br>--------------------------------</br>");
8     %>
9 </body>
 1 <body>
 2     <%
 3         double h = request.getParameter("h") == null ? 0 : Double
 4                 .parseDouble(request.getParameter("h"));
 5         double sd = request.getParameter("sd") == null ? 0 : Double
 6                 .parseDouble(request.getParameter("sd"));
 7         double xd = request.getParameter("xd") == null ? 0 : Double
 8                 .parseDouble(request.getParameter("xd"));
 9         double area = ((sd + xd) * h) / 2;
10         out.print("梯形上底:" + sd + "</br>下底:" + xd + "</br>高:" + h
11                 + "</br>面积:" + area);
12     %>
13 </body>

3.任务三、详见Word图片

 1 <body>
 2     <table border="1" align="center" bgcolor="yellow">
 3         <tr align="center">
 4             <td colspan="2"><jsp:include page="top.jsp"></jsp:include>
 5         <tr align="center">
 6             <td><jsp:include page="left.jsp"></jsp:include></td>
 7             <td><jsp:include page="right.jsp"></jsp:include></td>
 8         <tr align="center">
 9             <td colspan="2"><jsp:include page="end.jsp"></jsp:include>
10     </table>
11 </body>
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2  <%="top.jsp的文件内容包含在这里" %>
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 <%="left.jsp的文件内容包含在这里" %>
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 <%="right.jsp的文件内容包含在这里" %>
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 <%="end.jsp的文件内容包含在这里" %>

4.任务四、详见Word图片

 1 <body>
 2     <%
 3         int i = (int) (Math.random() * 10 + 1);
 4         if (i % 2 == 0) {
 5     %>
 6     <jsp:forward page="ou.jsp">
 7         <jsp:param value="<%=i %>" name="num" />
 8     </jsp:forward>
 9     <%
10         } else {
11     %>
12     <jsp:forward page="ji.jsp">
13         <jsp:param value="<%=i %>" name="num" />
14     </jsp:forward>
15     <%
16         }
17     %>
18 </body>
1 <body>
2     <%
3         String m = request.getParameter("num");
4         int n = Integer.parseInt(m);
5         out.print("随机数为" + n + "<br>");
6     %>
7     Hello,我是一个偶数!
8 </body>

 

标签:11,10,13,12,num,jsp5,课文
来源: https://www.cnblogs.com/gxl920/p/16095733.html