码迷,mamicode.com
首页 > Web开发 > 详细

jsp登陆

时间:2018-03-08 00:06:36      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:isp   end   oct   5.5   encoding   logio   ola   style   put   

<%@ page language="java" import="java.util.*"
 pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>    
    <title>login</title>
  </head>  
  <body>
   <form action="./dologin.jsp" method="post" >
        用户名:<input name="userName"/><br><br>
        密码:   <input name="passWord"/><br><br>
        <input type="submit" value="登陆"/><br><br>
   </form>
  </body>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
  <head>    
    <title>My JSP ‘success.jsp‘ starting page</title>  
  </head>
  <body>
   欢迎你!<%=request.getParameter("userName")
    %>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
   <%
           String username=request.getParameter("userName");
           String password=request.getParameter("passWord");
           if(username.equals("tom")&&password.equals("123"))
           {
               //跳转到成功页面
    request.getRequestDispatcher("success.jsp").forward(request, response);               
           }
           else{
               //返回登陆页面重新登陆
               response.sendRedirect("logion.jsp");
           }
    %>

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

   <%

       String username=request.getParameter("userName");

       String password=request.getParameter("passWord");

       if(username.equals("tom")&&password.equals("123"))

       {

           //跳转到成功页面

    request.getRequestDispatcher("success.jsp").forward(request, response);            

       }

       else{

           //返回登陆页面重新登陆

           response.sendRedirect("logion.jsp");

       }

    %>

 

 

jsp登陆

标签:isp   end   oct   5.5   encoding   logio   ola   style   put   

原文地址:https://www.cnblogs.com/excellencesy/p/8525608.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!