⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.jsp

📁 JSP聊天系统
💻 JSP
字号:
<%
/**
 *	$RCSfile: login.jsp,v $
 *	$Revision: 1.4 $
 *	$Date: 2000/12/18 02:03:11 $
 */
%>
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page contentType="text/html;charset=gb2312"%>

<%@	page import="com.coolservlets.forum.*,
                 com.coolservlets.forum.util.*" 
	errorPage="error.jsp"
%>

<%	////////////////////////
	// Authorization check
	
	// check for the existence of an authorization token
	Authorization authToken = SkinUtils.getUserAuthorization(request,response);
	
	// if the token was null, they're not authorized. Since this skin will
	// allow guests to view forums, we'll set a "guest" authentication
	// token
	if( authToken == null ) {
		authToken = AuthorizationFactory.getAnonymousAuthorization();
	}
%>


<%	///////////////////////
	// page forum variables
	
	// do not delete these
	ForumFactory forumFactory = ForumFactory.getInstance(authToken);
	User user = forumFactory.getProfileManager().getUser(authToken.getUserID());
	long userLastVisitedTime = SkinUtils.getLastVisited(request,response);
%>

<%	/////////////////////////////
	// get parameters, do a login
	
	// do a login if a login is requested
	boolean doLogin = ParamUtils.getBooleanParameter(request,"doLogin");
	String loginUsername = ParamUtils.getParameter(request,"username");
	String loginPassword = ParamUtils.getParameter(request,"password");
	boolean autoLogin = ParamUtils.getCheckboxParameter(request,"autoLogin");
	String referringPage = ParamUtils.getParameter(request,"referer");
	boolean errors = false;
	String errorMessage = "";
	if( doLogin ) {
		if( loginUsername == null || loginPassword == null ) {
			errors = true;
			errorMessage = "请输入用户名和密码!";
		}
		if( !errors ) {
			try {
				SkinUtils.setUserAuthorization(
					request,response,loginUsername,loginPassword,autoLogin
				);
				// at this point if no exceptions were thrown, the user is
				// logged in, so redirect to the page that sent us here:
				response.sendRedirect(referringPage);
				return;
			}
			catch( UnauthorizedException e ) {
				errors = true;
				errorMessage = "您填写的用户名和密码不正确!";
			}
		}
	}
%>

<%	//////////////////////
	// Header file include
	
	// The header file looks for the variable "title"
	String title = "Jive 论坛: 登录";
%>
<%@ include file="header.jsp" %>


<%	////////////////////
	// Breadcrumb bar
	
	// The breadcrumb file looks for the variable "breadcrumbs" which
	// represents a navigational path, ie "Home > My Forum > Hello World"
	String[][] breadcrumbs = {
		{ "论坛主页", "index.jsp" },
		{ "登录", "" }
	};
%>
<%@ include file="breadcrumb.jsp" %>

<%	///////////////////////
	// breadcrumb variables
	
	// change these values to customize the look of your breadcrumb bar
	
	// Colors
	String loginBgcolor = "#999999";
	String loginFgcolor = "#ffffff";
	String loginHeaderColor = "#ccccdd";
%>

<h2>登录</h2>

<%	if( errors ) { %>
<h4><i>错误: <%= errorMessage %></i></h4>
<%	} %>

<form action="login.jsp" method="post" name="loginForm">
<input type="hidden" name="doLogin" value="true">
<input type="hidden" name="referer" value="<%= (!errors)?request.getHeader("REFERER"):referringPage %>">

<center>

<table bgcolor="<%= loginBgcolor %>" cellpadding="1" cellspacing="0" border="0" width="350">
<td>
<table bgcolor="<%= loginFgcolor %>" cellpadding="4" cellspacing="0" border="0" width="100%">
<tr>
	<td align="right" width="50%">
	用户名:
	</td>
	<td width="50%">
	<input type="text" name="username" size="15" maxlength="25"
	 value="<%= (loginUsername!=null)?loginUsername:"" %>">
	</td>
</tr>
<tr>
	<td align="right" width="50%">
	密码:
	</td>
	<td width="50%">
	<input type="password" name="password" size="15" maxlength="25"
	 value="<%= (loginPassword!=null)?loginPassword:"" %>">
	</td>
</tr>
<tr>
	<td align="right" width="50%">
	<label for="cb01">自动登录</label>
	</td>
	<td width="50%">
	<input type="checkbox" name="autoLogin" id="cb01">
	<span class="label">
	(<a href="" 
	  onclick="alert('警告: 这样将在您的本地硬盘上存储您的用户名和口令.');return false;"
	  ><b>?</b></a>)
	</span>
	</td>
</tr>
<tr bgcolor="<%= loginHeaderColor %>">
	          <td align="right" colspan="2"> 
                <div align="center">
                  <input type="submit" value="登录">
                </div>
              </td>
</tr>
</table>
</td>
</table>

</center>

<p>

<script language="JavaScript" type="text/javascript">
<!--
	document.loginForm.username.focus();
//-->
</script>
	
<center>
<i>赶快加入啊! <a href="createAccount.jsp">注册新用户</a>.</i>
</center>
	
</form>

<p>

<%	/////////////////////
	// page footer 
%>
<%@ include file="footer.jsp" %>


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -