JSP-5番目の割り当て

<%@ page language = "java" import = "java.util。*" pageEncoding = "utf-8"%> 
<%
String path = request.getContextPath(); 
文字列basePath = request.getScheme()+ "://" + request.getServerName()+ ":" + request.getServerPort()+ path + "/"; 
%> 

<!DOCTYPE HTML PUBLIC "-// W3C // DTD HTML 4.01 Transitional // EN"> 
<html> 
  <head> 
    <base href = "<%= basePath%>"> 
    
    <title> My JSP 'インデックス。 jsp '開始ページ</ title> 
    <meta http-equiv = "pragma" content = "no-cache"> 
    <meta http-equiv = "cache-control" content = "no-cache"> 
    <meta http-equiv = 」     
    <link rel = "stylesheet" type = "text / css" href = "styles.css"> 
    -> 
    <style type = "text / css "> 
    body {font-size:16px;} 
    </ style> 
    <script type =" text / javascript "> 
    function mycheck(){ 
    if(form1.userName.value ==" "){ 
    alert(" Username cannot空白の場合、ユーザー名を入力してください "); 
    form1.userName.focuse(); 
    return; 
    } 
    if(form1.password.value ==" "){ 
    alert("パスワードを空にすることはできません。パスワードを入力してください); 
    form1。 password.focus(); 
    return; 
    } 
    if(form1。validationCode.value == ""){ 
    アラート( "確認コードは空にできません。確認コードを入力してください"); 
    form1.validationCode.focus();
    戻る; 
  int intmethod3 =(int)((((Math.random())* 5))+ 1);
    } 
    if(form1.validationCode.value!= form1.validationCode1.value){
    alert( "请输入正确的验证码"); 
    form1.validationCode.focus(); 
    戻る; 
    } 
    form1.submit1(); 
    } 
    </ script> 
  </ head> 
  
  <body> 
   <form action = "logincheck.jsp" name = "form1" method = "post">用户名
   :<input type = "text" name = "userName" size = " 16 "> <br> 
   密码:
   <input type =" password "name =" password "size =" 18 "> <br> 
   验证码:<input type =" text "name =" validationCode "onKeyDown =" if( event.keyCode == 13){form1.submit.focus();} "size =" 6 "> 
  <%
  int intmethod1 =(int)((((Math。random())* 5))+ 1); 
  int intmethod2 =(int)((((Math.random())* 5))+ 1); 
  int intmethod4 =(int)((((Math.random())* 5))+ 1);
  
  文字列intsum = intmethod1 + "" + intmethod2 + intmethod3 + intmethod4; 
   %> 
   <input type = "hidden" name = "validationCode1" value = "<%= intsum%>"> 
   <img style = "height:20px; weight:20px" src = "images / <%= intmethod1%>。 png "> 
   <img style =" height:20px; weight:20px "src =" images / <%= intmethod2%>。png "> 
   <img style =" height:20px; weight:20px "src =" images / < %= intmethod3%>。png "> 
   <img style =" height:20px; weight:20px "src =" images / <%= intmethod4%>。png "> 
   <br> 
   <input type =" submit "name =" submit1 "value ="登录 "onClick =" mycheck() ">
    
    

  

<%@ page language = " java " import = " java.util。* " pageEncoding = " utf-8 "%> 
<%
String path = request.getContextPath(); 
文字列basePath = request.getScheme()+ " :// " + request.getServerName()+ " " + request.getServerPort()+ path + " / " ;
%> 

<!DOCTYPE HTML PUBLIC " -// W3C // DTD HTML 4.01 Transitional // EN " > 
<html> 
  <head>href = " <%= basePath%> " > 
    
    <title> My JSP ' index.jsp '開始ページ</ 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 = "キーワード content = ); 
  文字列パスワード
    
  = request.getParameter(" password " );
  もし(request.getParameter(" validationCode1 ").equals(request.getParameter(" validationCode " ))){
   場合(name.equals(" 申奇")&&(password.equals(" 12345 " ))){ 
  セッション。 setAttribute(" userName " 、name); 
  response.sendRedirect(" main.jsp " ); 
  } else { 
  response.sendRedirect("); 
  } 
  } else { 
  response.sendRedirect(" login.jsp " ); 
  }
   %> 

     <br> 
  </ body> 
</ html>
<%@ page language = " java " import = " java.util。* " pageEncoding = " utf-8 "%> 
<%
String path = request.getContextPath(); 
文字列basePath = request.getScheme()+ " :// " + request.getServerName()+ " " + request.getServerPort()+ path + " / " ;
%> 

<!DOCTYPE HTML PUBLIC " -// W3C // DTD HTML 4.01 Transitional // EN " > 
<html> 
  <head>href = " <%= basePath%> " > 
    
    <title> My JSP ' index.jsp '開始ページ</ 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 = "キーワード content = keyword1、keyword2、keyword3 " > 
    <meta http-equiv = " description " content = " これは私のページです" > 
    <!- 
    <link rel = " stylesheet " type = " text / css " href = " styles.css " > 
    -> 
    
  </ head> 
  
  <body> 
  <%
 String name =(String)session.getAttribute(" userName " );
   %> 
您好 <%= name%>、欢迎您访问<br>
<a href = " exit.jsp ">【退出系统】</a> 
     <br> 
  </ body> 
</ html>

おすすめ

転載: www.cnblogs.com/TSHEN/p/12708847.html