• JSP第五周-session


    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
    
    
      </head>
      
      <body>
             <%
             String pinglun=request.getParameter("pinglun"); 
           
          
              session.setAttribute("e", pinglun);
              
              
              String c=(String)session.getAttribute("c");
              String e=(String)session.getAttribute("e");
              
             %>
           用户:  <%=c %>  &nbsp;&nbsp;&nbsp;&nbsp;评论:<%=e %> <br>
             
               
      </body>
    </html>
    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
    
    
      </head>
      
      <body>
      <%  String user1=request.getParameter("user1");
          String mima1=request.getParameter("mima1");
          
          
          
          
          session.setAttribute("a", user1);
          session.setAttribute("b", mima1);
          
      
         
            %>
      
      
           <form action="zhanghu.jsp">
               用户名:<input type="text" name="user2"> <br><br>
               密   码:<input type="password" name="mima2"><br><br>
               <input type="submit" value="登录">
           
           </form>
      
      </body>
    </html>
    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
    
      </head>
      
      <body>
        <% String user2=request.getParameter("user2");
           String mima2=request.getParameter("mima2");
           session.setAttribute("c", user2);
           session.setAttribute("d",mima2);
           
           String a=(String)session.getAttribute("a");
           String b=(String)session.getAttribute("b");
           String c=(String)session.getAttribute("c");
           String d=(String)session.getAttribute("d");
        
           
    
         %>
       <%
               if(a.equals(c)&&b.equals(d)){
                if(c.equals("admin")){
               out.println("后台操作页面"+"</br>");
               out.print("管理员账号"+c+"登录密码"+d);
               }else{
                 request.getRequestDispatcher("xinwen.jsp").forward(request, response);
               
               }
              
               }else{
           
                 response.sendRedirect("zhuce.jsp");
              }
           
                 
        %>
    
    
    
              
      
      </body>
    </html>
    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
    
    
      </head>
      
      <body>
        新闻直播间欢迎你!<br>
        <form action="xianshi.jsp">
        <input type="text" name="pinglun"><input type="submit" value="提交评论">
        </form>
      </body>
    </html>
    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
    
    
      </head>
      
      <body>
             <%
             String pinglun=request.getParameter("pinglun"); 
           
          
              session.setAttribute("e", pinglun);
              
              
              String c=(String)session.getAttribute("c");
              String e=(String)session.getAttribute("e");
              
             %>
           用户:  <%=c %>  &nbsp;&nbsp;&nbsp;&nbsp;评论:<%=e %> <br>
             
               
      </body>
    </html>
  • 相关阅读:
    iOS NSString中的搜索方法rangeOfString
    iOS 远程推送通知
    iOS PushMeBaby日志提示SSLwrite():-36 94
    iOS [[NSBundle mainBundle] pathForResource:@"" ofType:@""]无法获取到文件
    iOS 申请测试用的远程推送证书
    数据结构与算法学习笔记(五)
    iOS 上传新版本到AppStore时报错ITMS-90034
    数据结构与算法学习笔记(四)
    数据结构与算法学习笔记(三)
    iOS开发日记49-详解定位CLLocation
  • 原文地址:https://www.cnblogs.com/gsfwxj1820/p/12642392.html
Copyright © 2020-2023  润新知