一、頁面展示
-
登錄頁面
-
提交頁面
二、代碼
2.1 登錄頁面
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%><html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>用戶登錄</title><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css">
</head>
<body><div class="form-container"><h2>用戶登錄</h2><form action="zhuce/denglu_submit.jsp" method="post"><div class="form-group"><label for="username">賬號:</label><input type="text" id="username" name="username" /></div><div class="form-group"><label for="pwd">密碼:</label><input type="password" id="pwd" name="pwd" /></div><input type="submit" value="登陸" /></form><p class="register-link">還沒有賬戶? <a href="denglu.jsp">立即注冊</a></p></div>
</body>
</html>
2.2 提交頁面
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>提交結果</title><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css"><style>/* Additional styles specific to this page for displaying data */.data-display-group {margin-bottom: 15px;padding: 10px;border: 1px solid #FFD1DC; /* Pastel Pink border, consistent with input fields */border-radius: 6px;background-color: #FFF5FA; /* Lighter LavenderBlush */}.data-display-group strong {color: #C71585; /* MediumVioletRed for labels */margin-right: 8px;}</style>
</head><body>
<%// 設置請求編碼為 UTF-8,確保正確處理中文參數request.setCharacterEncoding("UTF-8");
%>
<div class="form-container"><h2>提交的數據</h2><div class="data-display-group"><strong>用戶名:</strong><%= request.getParameter("username") %></div><div class="data-display-group"><strong>密碼:</strong><%= request.getParameter("pwd") %></div><!--<div class="data-display-group"><strong>選擇提示問題:</strong><%= request.getParameter("question") %></div><div class="data-display-group"><strong>提示答案:</strong><%= request.getParameter("key") %></div><div class="data-display-group"><strong>選擇的愛好:</strong><%String[] like = request.getParameterValues("like");if (like != null && like.length > 0) {for(int i = 0; i < like.length; i++){out.print(like[i] + (i < like.length - 1 ? ", " : ""));}} else {out.print("無");}%></div>
--><p style="text-align: center; margin-top: 20px;"><a href="biaodan_submit2.jsp" class="submit-style-link">跳轉到第二個展示頁面</a></p>
</div></body>
</html>