Dùng Session lưu tên người dùng hiển thị lời chào khi Login web jsp
setSession
Java 2016
HttpSession sessions = request.getSession(true); sessions.setAttribute("user",userName); sessions.setAttribute("location",location);
getSession
Java 2016
HttpSession sessions = request.getSession(); String user = (String) sessions.getAttribute("user"); String location = (String) sessions.getAttribute("location");
getSession
Html 2016
<span>Wellcome: ${sessionScope.user } </span> <span>Wellcome: ${sessionScope.location } </span>
0 nhận xét:
Post a Comment