jsp第5次作业

<body>
  <h2 class="a">欢迎来到新闻发布系统</h2>
    <form action="denglu.jsp" >
    <button >登录</button></form>&nbsp;&nbsp;
    <form action="zhuce.jsp" class="b">
    <button>注册</button>
    </form>
  </body>
 
 
<body>
    <h2>注册页面</h2>
    <form action="denglu.jsp" method="get">
        账户:<input type="text" name="zzhanghao"><br>
        密码:<input type="password" name="zmima"> 
     <input type="submit" value="注册">  </form>
     <br>
  </body>
 
 
 <h2>登录页面</h2>
  <%
  String zzh=request.getParameter("zzhanghao");
  String zmm=request.getParameter("zmima");
  session.setAttribute("zzzhanghao", zzh);
  session.setAttribute("zzmima", zmm);
   %>
 <form action="dchuli.jsp" method="get">
      账户:<input type="text" name="dzhanghao"><br>
    密码:<input type="password" name="dmima">
<input type="submit"  value="登录"></form>
    <br>
  </body>
 
 
 </head>
  
  <!-- 新闻页面 -->
  <body>
   <form action="pyan.jsp">
    
      最新新闻<br><br>评论:<input type="text" name="pinglun"><input type="submit" value="提交评论"><br></form> <br>
  </body>
 
 
 </head>
  
  <!-- 评论发表 -->
  <body>
  <%
  String py=request.getParameter("pinglun");
  session.setAttribute("pyanzheng", py);
  String yh=(String)session.getAttribute("ddzhanghao");
  String pl=(String)session.getAttribute("pyanzheng");
   %>
   <form action="">
      最新新闻<br><br>评论:<input type="text"><input type="submit" value="提交评论"><br>
      用户:<%= yh%>说:<%= pl%>
      </form> <br>
  </body>
 
 
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'dchuli.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">
    -->

  </head>
  
  <body>
   <%
     String dzh=request.getParameter("dzhanghao");
     String dmm=request.getParameter("dmima");
     session.setAttribute("ddzhanghao", dzh);
     session.setAttribute("ddmima", dmm);
     String zzzhanghao=(String)session.getAttribute("zzzhanghao");
     String zzmima=(String)session.getAttribute("zzmima");
     String ddzhanghao=(String)session.getAttribute("ddzhanghao");
     String ddmima=(String)session.getAttribute("ddmima");
   
     if(ddzhanghao==null||ddmima==null){
     ddzhanghao="orr";
     ddmima="orr";
     }
     
      if(zzzhanghao==null||zzmima==null){
zzzhanghao="eorr";
zzmima="eorr";
    }
    
 if(zzzhanghao.equals(ddzhanghao)&&zzmima.equals(ddmima)){
 if(zzzhanghao.equals("admin")){
 out.println("后台操作页面"+"</br>");
out.println("管理员信息"+"</br>");out.print("管理员账号"+ddzhanghao+"登录密码"+ddmima);
 }else{
    request.getRequestDispatcher("index2.jsp").forward(request, response);
    }
    }else{
    //out.print(dzhanghao);
    String a=(String)session.getAttribute("zzzhanghao");
     String b=(String)session.getAttribute("zzmima");
    request.getRequestDispatcher("denglu.jsp").forward(request, response);
    }
    

     %>
<!-- 
 注册账号<%=zzzhanghao %>注册密码<%=zzmima %><br>
 登录账号<%=ddzhanghao %> 登录密码<%=ddmima %>
-->
   <br>
  </body>

猜你喜欢

转载自www.cnblogs.com/lyccc/p/12658010.html