濮阳杆衣贸易有限公司

主頁 > 知識(shí)庫 > JSP中param動(dòng)作的實(shí)例詳解

JSP中param動(dòng)作的實(shí)例詳解

熱門標(biāo)簽:南通通訊外呼系統(tǒng)產(chǎn)品介紹 給地圖標(biāo)注得傭金 自繪地圖標(biāo)注數(shù)據(jù) 潤滑油銷售電銷機(jī)器人 海外圖書館地圖標(biāo)注點(diǎn) 外呼系統(tǒng)使用方法 電銷機(jī)器人免培訓(xùn) 如何看懂地圖標(biāo)注點(diǎn) 電話機(jī)器人需要使用網(wǎng)絡(luò)嗎

JSP中param動(dòng)作的實(shí)例詳解

一 語法

jsp:param name="參數(shù)名" value="參數(shù)值">

常常與jsp:forward>一起使用,作為其子標(biāo)簽存在。 

二 代碼

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>系統(tǒng)登錄/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="admin@123.net" 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>
 

三 運(yùn)行結(jié)果

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

您可能感興趣的文章:
  • JSP中的編譯指令和動(dòng)作指令的兩點(diǎn)區(qū)別
  • jsp的常用指令有哪些(編譯指令/動(dòng)作指令整理)
  • 十三、JSP動(dòng)作
  • 在JSP頁面中動(dòng)態(tài)生成圖片驗(yàn)證碼的方法實(shí)例
  • SpringBoot+jsp項(xiàng)目啟動(dòng)出現(xiàn)404的解決方法
  • spring boot整合jsp及設(shè)置啟動(dòng)頁面的方法
  • JSP頁面的靜態(tài)包含和動(dòng)態(tài)包含使用方法
  • jsp-解決文件上傳后重啟Tomcat時(shí)文件自動(dòng)刪除問題
  • JSP常用七大動(dòng)作指令實(shí)例解析

標(biāo)簽:樂山 內(nèi)江 廣州 南京 大連 銅川 貸款邀約 黃石

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《JSP中param動(dòng)作的實(shí)例詳解》,本文關(guān)鍵詞  JSP,中,param,動(dòng)作,的,實(shí)例,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《JSP中param動(dòng)作的實(shí)例詳解》相關(guān)的同類信息!
  • 本頁收集關(guān)于JSP中param動(dòng)作的實(shí)例詳解的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    兴文县| 荆州市| 漳浦县| 昌邑市| 钦州市| 咸丰县| 新乡市| 手游| 永丰县| 南川市| 常熟市| 苏尼特左旗| 元朗区| 建德市| 屯留县| 托克逊县| 梁平县| 台中县| 淮滨县| 太康县| 康马县| 青海省| 车险| 永安市| 大邑县| 花莲县| 南开区| 遵化市| 田阳县| 彭水| 双城市| 临猗县| 合川市| 巴彦淖尔市| 通山县| 永平县| 泉州市| 涿州市| 澳门| 芜湖市| 五常市|