久久福利_99r_国产日韩在线视频_直接看av的网站_中文欧美日韩_久久一

您的位置:首頁技術文章
文章詳情頁

JSP中param動作的實例詳解

瀏覽:191日期:2022-06-07 10:25:55

JSP中param動作的實例詳解

一 語法

<jsp:param name="參數名" value="參數值">

常常與<jsp:forward>一起使用,作為其子標簽存在。

二 代碼

1、login.jsp

<%@ page language="java" import="java.util.*" contentType="text/html; charset=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%>" rel="external nofollow" rel="external nofollow" rel="external nofollow" >    <title>My JSP "login.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" rel="external nofollow" rel="external nofollow" rel="external nofollow" >    -->  </head>  <body>  <h1>系統登錄</h1>  <hr>  <form name="loginForm" action="dologin.jsp" method="post">   <table>    <tr>     <td>用戶名:</td>     <td><input type="text" name="username"/></td>    </tr>    <tr>     <td>密碼:</td>     <td><input type="password" name="password"/></td>    </tr>    <tr>     <td colspan="2"><input type="submit" value="登錄"/></td>    </tr>   </table>  </form> </body></html>

2、dologin.jsp

<%@ page language="java" import="java.util.*" contentType="text/html; charset=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%>" rel="external nofollow" rel="external nofollow" rel="external nofollow" >    <title>My JSP "dologin.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" rel="external nofollow" rel="external nofollow" rel="external nofollow" >    -->  </head>  <body>  <jsp:forward page="user.jsp">   <jsp:param value="[email protected]" name="email"/>   <jsp:param value="888888" name="password"/>  </jsp:forward> </body></html>

3、user.jsp

<%@ page language="java" import="java.util.*" contentType="text/html; charset=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%>" rel="external nofollow" rel="external nofollow" rel="external nofollow" >    <title>My JSP "user.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" rel="external nofollow" rel="external nofollow" rel="external nofollow" >    -->  </head>  <body>  <h1>用戶資料</h1>  <hr>  <%    request.setCharacterEncoding("utf-8");    String username = "";    String password = "";    String email = "";    if(request.getParameter("username")!=null)    {     username = request.getParameter("username");    }    if(request.getParameter("password")!=null)    {     password = request.getParameter("password");    }    if(request.getParameter("email")!=null)    {     email = request.getParameter("email");    }     %>    用戶名:<%=username %><br>    密碼:<%=password %><br>    電子郵箱:<%=email %><br> </body></html> 

三 運行結果

如有疑問請留言或者到本站社區交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

標簽: JSP
主站蜘蛛池模板: 亚洲www啪成人一区二区 | 免费在线观看一级毛片 | 日本在线播放 | 91看片在线观看 | 婷婷丁香六月天 | 午夜伦理影院 | 伊人国产精品 | 97精品超碰一区二区三区 | 国产一级免费 | 久久精品小视频 | 国产最好的精华液网站 | 不卡一区| 亚洲三区在线观看 | 国产亚洲成av人片在线观看桃 | 国产在线成人 | 国产在线精品一区二区 | 成人免费观看视频 | 精品自拍视频 | 成人小视频在线观看 | 激情久久av一区av二区av三区 | 欧美日韩综合视频 | 婷婷综合五月 | 久久精品国产亚洲一区二区三区 | 鲁一鲁影院 | 91xx在线观看 | 国产成人精品一区二区三区四区 | 一区二区三区视频 | 在线欧美成人 | 日韩精品在线免费观看 | 成人在线播放网站 | 蜜桃中文字幕 | 欧美一级精品片在线看 | 久久精品亚洲精品国产欧美 | 四虎中文字幕 | 亚洲色图偷拍视频 | 成人免费视频观看视频 | 国产精品久久精品 | 免费毛片在线播放 | 曰本人一级毛片免费完整视频 | 欧美日韩福利视频 | 视频一区二区国产 |