JSP quinta semana -session

 

<% @ Page language = "java" importación = "java.util. *" PageEncoding = "UTF-8" %> 


<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 4.01 Transitional // EN"> 
<html > 
  <head> 


  </ head> 
  
  <body> 
         <% 
         cadena pinglun = request.getParameter ( "pinglun" ); 
       
      
          session.setAttribute ( "e" , pinglun); 
          
          
          Cadena c = (String) session.getAttribute ( "c" ); 
          Cuerda E = (String) session.getAttribute ( "e" ); 
          
         %> 
       用户:   <% = c%> & nbsp; & nbsp; & nbsp; & nbsp;评论:
         
           
<% @ Page language = "java" importación = "java.util. *" PageEncoding = "UTF-8" %> 


<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 4.01 Transitional // EN"> 
<html > 
  <head> 


  </ head> 
  
  <body> 
  <% serie de usuario1 = request.getParameter ( "usuario1" ); 
      Cadena mima1 = request.getParameter ( "mima1" ); 
      
      
      
      
      session.setAttribute ( "a" , usuario1); 
      session.setAttribute ( "b" , mima1); 
      
  
     
        %> 
  
  
       <Acción de formulario => "zhanghu.jsp" 
           用户名: <input type = nombre de "texto" = "usuario2">
           <input type = "submit" value = "登录">
       
  
  </ body> 
</ html>
<% @ Page language = "java" importación = "java.util. *" PageEncoding = "UTF-8" %> 


<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 4.01 Transitional // EN"> 
<html > 
  <head> 

  </ head> 
  
  <body> 
    <% serie de usuario2 = request.getParameter ( "usuario2" ); 
       Cadena mima2 = request.getParameter ( "mima2" ); 
       session.setAttribute ( "c" , usuario2); 
       session.setAttribute ( "d" , mima2); 
       
       String a = (String) session.getAttribute ( "a" ); 
       Cadena b = (String) session.getAttribute ("); 
       Cadena d = (String) session.getAttribute ( "d" ); 
    
       

     %> 
   <% Si (a.equals (c) && b.equals (d)) {
             si (c.equals ( "admin" )) { 
           out.println ( "后台操作页面" + "</ br>" ) ; 
           out.print ( "管理员账号" + c + "登录密码" + d); 
           } Demás { 
             request.getRequestDispatcher ( "xinwen.jsp" ) .forward (petición y respuesta); 
           } 
           } Demás { 
             response.sendRedirect ( "zhuce.jsp" );
           
           
          
       
       
             
    



          
  
<% @ Page language = "java" importación = "java.util. *" PageEncoding = "UTF-8" %> 


<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 4.01 Transitional // EN"> 
<html > 
  <head> 


  </ head> 
  
  <body> 
    新闻直播间欢迎你! <br> 
    <form action = "xianshi.jsp"> 
    <type = input name "texto" = "pinglun"> <input type = "submit" value = "提交评论"> 
    </ form> 
  </ body> 
</ html>
<% @ Page language = "java" importación = "java.util. *" PageEncoding = "UTF-8" %> 


<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 4.01 Transitional // EN"> 
<html > 
  <head> 


  </ head> 
  
  <body> 
         <% 
         cadena pinglun = request.getParameter ( "pinglun" ); 
       
      
          session.setAttribute ( "e" , pinglun); 
          
          
          Cadena c = (String) session.getAttribute ( "c" ); 
          Cuerda E = (String) session.getAttribute ( "e" ); 
          
         %> 
       用户:   <% = c%> & nbsp; & nbsp; & nbsp; & nbsp;评论:
         
           

 

Supongo que te gusta

Origin www.cnblogs.com/gsfwxj1820/p/12642392.html
Recomendado
Clasificación