JSP 登录页面实现:用户名密码校验及重定向
Login
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String username = request.getParameter("username");
String password = request.getParameter("password");
if(username.equals("admin") && password.equals("123")) {
response.sendRedirect("Success.jsp");
} else {
response.sendRedirect("Error.jsp");
}
%>
欢迎登录
用户名或密码错误
该页面将在5秒后自动回到用户登录页面。
AI 优化版
原文地址:https://www.cveoy.top/t/topic/oh9a 著作权归作者所有。请勿转载和采集!