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

📄 tokentag.java

📁 一个实用工具类
💻 JAVA
字号:
/* * 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.html;import java.io.IOException;import javax.servlet.jsp.JspException;import javax.servlet.jsp.JspWriter;import javax.servlet.jsp.tagext.TagSupport;import org.apache.struts.action.Action;import org.butor.log.Log;import org.butor.web.Constants;import org.butor.web.context.IWebContext;import org.butor.web.context.WebContextService;/** * Put token in form to be submitted and checked by an intereseted action. *  * @author Aiman SAWAN */public class TokenTag extends TagSupport {		/**	 * @see Tag#doStartTag()	 */	public int doStartTag() throws JspException {		IWebContext context = WebContextService.getContext();		if (context == null){			Log.logStr(this, Log.LOG_TYPE_ERROR, "doStartTag()", "Got null context!");			return EVAL_PAGE;		}			JspWriter writer = pageContext.getOut();		if (writer == null) {			Log.logStr(this, Log.LOG_TYPE_ERROR, "doStartTag()", 				"Got null JspWriter!");			return EVAL_PAGE;		}		        try {            writer.print("<input type=\"hidden\" name=\"");            writer.print(Constants.TOKEN);            writer.print("\" value=\"");            writer.print(context.readProperty(Constants.TOKEN));            writer.println("\"/>");                    } catch (IOException e) {            throw new JspException(e.toString());        }								return EVAL_PAGE;	}}

⌨️ 快捷键说明

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