logged.java

来自「一个实用工具类」· Java 代码 · 共 63 行

JAVA
63
字号
/* * Copyright (C) butor.com. All rights reserved. * * This software is published under the terms of the GNU Library General * Public License (GNU LGPL), a copy of which has been included with this * distribution in the LICENSE.txt file.  */package org.butor.web.taglib.logic;import javax.servlet.jsp.JspException;import javax.servlet.jsp.tagext.TagSupport;import org.butor.profile.IProfile;import org.butor.web.context.IWebContext;import org.butor.web.context.WebContextService;/** * @author sawanai * * Tell if user logged in */public class Logged extends TagSupport {	protected String value = null;		public String getValue() {		return this.value;	}	public void setValue(String value) {		this.value = value;	}	/**	 * @see javax.servlet.jsp.tagext.Tag#doStartTag()	 */	public int doStartTag() throws JspException {				if (value == null) {			this.value = "true";		}			boolean loggedIn = false;				IWebContext ctxt = WebContextService.getContext();		if (ctxt != null) {			IProfile profile = ctxt.getProfile();			if (profile != null) {				loggedIn = true;			}		}		if (this.value.equalsIgnoreCase("true")) {			if (loggedIn) {				return EVAL_BODY_INCLUDE;			}		} else {			if (!loggedIn) {				return EVAL_BODY_INCLUDE;			}		}		return SKIP_BODY;	}}

⌨️ 快捷键说明

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