📄 texttag.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 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 TextTag extends org.apache.struts.taglib.html.TextTag { protected String f_format = null; protected String f_dataType = null; protected String f_formatProperty = null; protected String f_dataTypeProperty = null; public void setformat(String fp) { f_format = fp; } public String getformat() { return f_format; } public void setformatProperty(String fpp) { f_formatProperty = fpp; } public String getformatProperty() { return f_formatProperty; } public void setDataType(String dt) { f_dataType = dt; } public String getDataType() { return f_dataType; } public void setDataTypeProperty(String dtp) { f_dataTypeProperty = dtp; } public String getDataTypeProperty() { return f_dataTypeProperty; } /** * Release all allocated resources. */ public void release() { super.release(); f_format = null; f_dataType = null; f_formatProperty = null; f_dataTypeProperty = null; } /** * Generate the required input tag. * Indexed property since 1.1 * * @exception JspException if a JSP exception has occurred */ 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 { // the property is disable, we must render it properly if (f_format == null && f_formatProperty != null) { f_format = (String) RequestUtils.lookup(pageContext, name, f_formatProperty, null); } if (f_dataType == null && f_dataTypeProperty != null) { f_dataType = (String) RequestUtils.lookup(pageContext, name, f_dataTypeProperty, null); } if (value != null) { TagLibHelper.renderStaticField(pageContext, property, value, TagLibHelper.format(value, f_dataType, f_format)); } else if (redisplay || !"password".equals(type)) { // Lookup the property value Object propValue = RequestUtils.lookup(pageContext, name, property, null); if (propValue == null) { propValue = ""; } TagLibHelper.renderStaticField(pageContext, property, propValue.toString(), TagLibHelper.format(propValue, f_dataType, f_format)); } } return (EVAL_BODY_BUFFERED); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -