📄 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.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 String name; private String action; private String method; private String onsubmit; /** * @jsp.attribute description="Define a form name." required="true" * rtexprvalue="true" */ public String getName() { return TagUtils.evaluateExpressionAsString("name", name, this, pageContext); } public void setName(String name) { this.name = name; } /** * @jsp.attribute description="Define a form action." required="true" * rtexprvalue="true" */ public String getAction() { return TagUtils.evaluateExpressionAsString("action", action, this, pageContext); } public void setAction(String action) { this.action = action; } /** * @jsp.attribute description="Define a form method." required="false" * rtexprvalue="true" */ public String getMethod() { String method = TagUtils.evaluateExpressionAsString("method", this.method, this, pageContext); if (StringUtils.isBlank(method)) { return TagUtils.getModel(this).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 TagUtils.evaluateExpressionAsString("onsubmit", onsubmit, this, pageContext); } public void setOnsubmit(String onsubmit) { this.onsubmit = onsubmit; } public int doStartTag() throws JspException { if (TagUtils.isIteratingBody(this)) { return SKIP_BODY; } 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); TagUtils.getModel(this).getFormHandler().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 + -