textareatag.java

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

JAVA
67
字号
/* * 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 javax.servlet.jsp.JspException;import org.apache.struts.util.RequestUtils;import org.apache.struts.util.ResponseUtils;import org.butor.web.action.IButorActionForm;/** * @author nacroaz * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. */public class TextareaTag extends org.apache.struts.taglib.html.TextareaTag {	protected String keep_format = null;	public String getKeep_format() {		return keep_format;	}		public void setKeep_format(String c) {		keep_format = c;		}    public int doStartTag() throws JspException {	   	// Find and check the form bean	    		   	    	Object o = RequestUtils.lookup(pageContext, name, null);        if (! (o instanceof IButorActionForm)) {			ResponseUtils.write(pageContext, "The form bean must be an instance of ButorActionForm !!!");  			return SKIP_BODY;        }                IButorActionForm form = (IButorActionForm) o;                // If property is enable, use super class definition                if (form.getEnabled(property)) {        	return super.doStartTag();        } else {        	        	boolean mustFormat = (keep_format == null) ? true :  keep_format.equals("1");        	        	// the property is disable, we must render it properly        		        if (value != null) {	        	TagLibHelper.renderStaticField(pageContext, property, value, mustFormat);				    	        	        } else {	        	// Lookup the property value	        	    	        Object value = RequestUtils.lookup(pageContext, name, property, null);        	            	    if (value == null) {            	    value = "";        	    }        	    	        	TagLibHelper.renderStaticField(pageContext, property, value.toString(), mustFormat);	        	        	    	        }	                }    	    	    			return (EVAL_BODY_BUFFERED);    }}

⌨️ 快捷键说明

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