<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "
PageEncoding="utf-8" import="Java. IO. *" import="com. Liu. User" % & gt;
<meta HTTP - equiv="content-type" Content="text/HTML. Charset=utf-8 "& gt;
<body>
<%
response.setContentType("text/html; charset=utf-8");
User User=(User) session. The getAttribute (" User ");
If (user==null) {
Response. GetWriter (). Print (" you have not login, please & lt; A href='https://bbs.csdn.net/topics/login.jsp' & gt; Login & lt;/a>" );
}
The else {
Response. GetWriter (). Print (" you have log in, you're welcome, "+ user. The getUsername () +"!" );
The response. GetWriter (). Print (" & lt; A href='https://bbs.csdn.net/topics/LogoutServlet.jsp' & gt; Exit & lt;/a>" );
Cookie Cookie=new Cookie (" JSESSIONID, "session. GetId ());
Cookies. SetMaxAge (60 * 30);
Cookies. SetPath ("/L ");
The response addCookie (cookies);
}
% & gt;