第四天

 <body>
 <table border="1">
    <%for(int i=0;i<3;i++){%>
    <tr>
        <td width="50"><%=i %></td>
        <td width="50"><%=i %></td>
        <td width="50"><%=i %></td>
    </tr>
    <%} %>
    </table>
     <jsp:plugin   code="Clock.class"   codebase="Applet" type="applet"></jsp:plugin>
    其實真的很想你,只是你不知道而已 <br>
  </body>
編寫一個jsp程序,使用<jsp:forward>動做實現跳轉,並經過<jsp:param>動做元素傳遞參數,在跳轉頁中接收參數並輸出。
<%@ page language="java"   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>跳轉頁面1</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:forward動做指令實現服務器端跳轉。
   <jsp:forward page="practiceforward2.jsp">
   <jsp:param name="name" value="yaoming"/>
   </jsp:forward>
  </body>
</html>

 
 
<%@ page language="java"  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>跳轉頁面2</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:forward動做指令實現服務器端跳轉。
   <jsp:forward page="practiceforward3.jsp">
   <jsp:param name="name" value="James"/>
   </jsp:forward>
  </body>
</html>

 
 
 
<%@ page language="java"  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>跳轉到的頁面</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>
    <h2>跳轉到的頁面</h2>
    <p>接收到的參數</p>
    <%
     string strname=request.getParameter("name");
     
     %>
     <%="name參數值爲"+strname %>
  </body>
</html>
 
 
因爲時間問題,這個程序還有一些問題,但願儘快解決!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
相關文章
相關標籤/搜索