81,092
社区成员
发帖
与我相关
我的任务
分享
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<%
if(session.getAttribute("username")!=null&& session.getAttribute("email")!=null){
%>
username:<%=session.getAttribute("username")%>
email:<%=session.getAttribute("email")%>
<%}else{%>
<form action="showmsg.jsp" method="method">
username<input type="text" name="username" value=""><br>
email<input type="text" name="email" value=""><br>
<input type="submit" value="submit"/>
</form>
<%}%>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'showmsg.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%
out.print(request.getParameter("username")+" "+request.getParameter("email"));
session.setAttribute("username",request.getParameter("username"));
session.setAttribute("email",request.getParameter("email"));
%>
<br>
<a href="logout.jsp">exit</a>
</body>
</html>
<%
session.invalidate();
response.sendRedirect("login.jsp");
%>