国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

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

JSP中param動作的實例詳解

瀏覽:173日期: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
主站蜘蛛池模板: 欧美日韩精品一区二区三区不卡 | 免费99视频有精品视频高清 | 91国内在线 | 特黄aa级毛片免费视频播放 | 日本欧美一区二区三区视频 | 爱逼综合网 | 欧美视频精品在线 | 久久久久亚洲香蕉网 | 在线一区视频 | 亚洲美女中文字幕 | 欧美性色黄大片www 欧美性色黄大片一级毛片视频 | 国产成人三级经典中文 | 国产91一区二这在线播放 | www.九九| 欧美大片一区二区三区 | 色综合久久88色综合天天小说 | 久久综合狠狠综合久久97色 | 欧美激情特级黄aa毛片 | 久草资源视频 | 美女视频网站免费播放视 | 亚洲精品理论 | 国产精品美女久久久久网站 | 真人毛片免费全部播放完整 | 欧美成人性色区 | 精品久久久久亚洲 | www.黄色片 | 特级毛片全部免费播放a一级 | 久草首页在线 | 爱综合 | 日韩成人中文字幕 | 国产成人做受免费视频 | 亚洲精品一区二区三区福利 | 俄罗斯一级黄色片 | 国产浮力第一页草草影院 | 亚洲欧美不卡中文字幕 | 男女免费观看在线爽爽爽视频 | 免费播放欧美毛片 | 国内精品久久久久久中文字幕 | 国产初高中生粉嫩无套第一次 | 91亚洲免费 | aaaa欧美高清免费 |