zoukankan      html  css  js  c++  java
  • 编写一个JSP程序实现用户登录

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <form action="zhuye.jsp" method="post" >
    登录:<input type="text" name="name">
    <br>
    密码:<input type="password" name="password" >
    <br>
    <input type="submit" value="提交">
    </form>
    </body>
    </html>
    <%@page import="javax.tools.ForwardingFileObject"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <%  
     String name="wencai";
     String password="123";
     if(!name.equals(request.getParameter("name"))||!password.equals(request.getParameter("password")))
     {
    %>
         <meta http-equiv="Refresh" content="0;url=errorpage.jsp">
    <%    
     }
     else
     {
         out.println("提交成功");
     }
    %>
    </body>
    </html>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ page isErrorPage="false"%>    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>cuowu</title>
    </head>
    <body>
    对不起,输入出错!
    <meta http-equiv="refresh" content="30;url=denglu.jsp">
    </body>
    </html>

     

  • 相关阅读:
    Visual Studio中View页面与Js页面用快捷键互相跳转
    使用NLog记录业务日志到数据库
    Js笛卡尔乘积
    多线程更新一个表里面的不同行也可能会死锁
    当请求参数与网站编码不一致时乱码解决方法
    WIN7下vs2010滑轮滚动不正确的解决方法
    VS 2017 代码报错编译正常
    C#表达式树
    .net core 学习 读取配置文件
    .net core 上传文件Demo
  • 原文地址:https://www.cnblogs.com/wenwen123/p/5614743.html
Copyright © 2011-2022 走看看