📄 formtag.java
字号:
/* * Copyright 2004 original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.extremecomponents.table.tag;import javax.servlet.jsp.JspException;import javax.servlet.jsp.tagext.TagSupport;import org.apache.commons.lang.StringUtils;import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;import org.extremecomponents.base.BaseModel;import org.extremecomponents.table.bean.Attributes;import org.extremecomponents.table.bean.Form;import org.extremecomponents.table.core.TableProperties;/** * @jsp.tag name="form" display-name="FormTag" body-content="JSP" description="A * form can be placed in the body of the table." * * @author Jeff Johnston */public class FormTag extends TagSupport implements ExtendedAttributes { private static final long serialVersionUID = 573881459303927870L; private String name; private String action; private String method; private String onsubmit; public BaseModel getModel() { TableTag tableTag = (TableTag) findAncestorWithClass(this, TableTag.class); return tableTag.getModel(); } /** * @jsp.attribute description="Define a form name." required="true" * rtexprvalue="true" */ public String getName() { return name; } public void setName(String name) { this.name = name; } /** * @jsp.attribute description="Define a form action." required="true" * rtexprvalue="true" */ public String getAction() { return action; } public void setAction(String action) { this.action = action; } /** * @jsp.attribute description="Define a form method." required="false" * rtexprvalue="true" */ public String getMethod() { if (StringUtils.isBlank(method)) { return getModel().getProperties().getProperty(TableProperties.METHOD); } return method; } public void setMethod(String method) { this.method = method; } /** * @jsp.attribute description="Define a form onsubmit." required="false" * rtexprvalue="true" */ public String getOnsubmit() { return onsubmit; } public void setOnsubmit(String onsubmit) { this.onsubmit = onsubmit; } public int doStartTag() throws JspException { TableTag tableTag = (TableTag) findAncestorWithClass(this, TableTag.class); if (tableTag.getRowCount() > 0) //only go through the first pass { return SKIP_BODY; } if (action != null) { setAction((String) ExpressionEvaluatorManager.evaluate("action", action, String.class, this, pageContext)); } Form form = new Form(); form.addAttribute(Form.NAME, getName()); form.addAttribute(Form.ACTION, getAction()); form.addAttribute(Form.METHOD, getMethod()); form.addAttribute(Form.ONSUBMIT, getOnsubmit()); addExtendedAttributes(form); tableTag.addForm(form); return EVAL_BODY_INCLUDE; } public void addExtendedAttributes(Attributes attributes) throws JspException { } public void release() { name = null; action = null; method = null; onsubmit = null; super.release(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -