?? formtag.java
字號:
/*
* $Id: FormTag.java 331056 2005-11-06 01:29:01Z niallp $
*
* Copyright 1999-2005 The Apache Software Foundation.
*
* 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.apache.struts.taglib.html;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.config.FormBeanConfig;
import org.apache.struts.config.ModuleConfig;
import org.apache.struts.taglib.TagUtils;
import org.apache.struts.util.MessageResources;
import org.apache.struts.util.RequestUtils;
/**
* Custom tag that represents an input form, associated with a bean whose
* properties correspond to the various fields of the form.
*
* @version $Rev: 331056 $ $Date: 2005-11-06 01:29:01 +0000 (Sun, 06 Nov 2005) $
*/
public class FormTag extends TagSupport {
// ----------------------------------------------------- Instance Variables
/**
* The action URL to which this form should be submitted, if any.
*/
protected String action = null;
/**
* The module configuration for our module.
*/
protected ModuleConfig moduleConfig = null;
/**
* The content encoding to be used on a POST submit.
*/
protected String enctype = null;
/**
* The name of the field to receive focus, if any.
*/
protected String focus = null;
/**
* The index in the focus field array to receive focus. This only applies if the field
* given in the focus attribute is actually an array of fields. This allows a specific
* field in a radio button array to receive focus while still allowing indexed field
* names like "myRadioButtonField[1]" to be passed in the focus attribute.
* @since Struts 1.1
*/
protected String focusIndex = null;
/**
* The line ending string.
*/
protected static String lineEnd = System.getProperty("line.separator");
/**
* The ActionMapping defining where we will be submitting this form
*/
protected ActionMapping mapping = null;
/**
* The message resources for this package.
*/
protected static MessageResources messages =
MessageResources.getMessageResources(Constants.Package + ".LocalStrings");
/**
* The request method used when submitting this form.
*/
protected String method = null;
/**
* The onReset event script.
*/
protected String onreset = null;
/**
* The onSubmit event script.
*/
protected String onsubmit = null;
/**
* Include language attribute in the focus script's <script> element. This
* property is ignored in XHTML mode.
* @since Struts 1.2
*/
protected boolean scriptLanguage = true;
/**
* The ActionServlet instance we are associated with (so that we can
* initialize the <code>servlet</code> property on any form bean that
* we create).
*/
protected ActionServlet servlet = null;
/**
* The style attribute associated with this tag.
*/
protected String style = null;
/**
* The style class associated with this tag.
*/
protected String styleClass = null;
/**
* The identifier associated with this tag.
*/
protected String styleId = null;
/**
* The window target.
*/
protected String target = null;
/**
* The name of the form bean to (create and) use. This is either the same
* as the 'name' attribute, if that was specified, or is obtained from the
* associated <code>ActionMapping</code> otherwise.
*/
protected String beanName = null;
/**
* The scope of the form bean to (create and) use. This is either the same
* as the 'scope' attribute, if that was specified, or is obtained from the
* associated <code>ActionMapping</code> otherwise.
*/
protected String beanScope = null;
/**
* The type of the form bean to (create and) use. This is either the same
* as the 'type' attribute, if that was specified, or is obtained from the
* associated <code>ActionMapping</code> otherwise.
*/
protected String beanType = null;
/**
* The list of character encodings for input data that the server should
* accept.
*/
protected String acceptCharset = null;
/** Controls whether child controls should be 'disabled'. */
private boolean disabled = false;
/** Controls whether child controls should be 'readonly'. */
protected boolean readonly = false;
// ------------------------------------------------------------- Properties
/**
* Return the name of the form bean corresponding to this tag. There is
* no corresponding setter method; this method exists so that the nested
* tag classes can obtain the actual bean name derived from other
* attributes of the tag.
*/
public String getBeanName() {
return beanName;
}
/**
* Return the action URL to which this form should be submitted.
*/
public String getAction() {
return (this.action);
}
/**
* Set the action URL to which this form should be submitted.
*
* @param action The new action URL
*/
public void setAction(String action) {
this.action = action;
}
/**
* Return the content encoding used when submitting this form.
*/
public String getEnctype() {
return (this.enctype);
}
/**
* Set the content encoding used when submitting this form.
*
* @param enctype The new content encoding
*/
public void setEnctype(String enctype) {
this.enctype = enctype;
}
/**
* Return the focus field name for this form.
*/
public String getFocus() {
return (this.focus);
}
/**
* Set the focus field name for this form.
*
* @param focus The new focus field name
*/
public void setFocus(String focus) {
this.focus = focus;
}
/**
* Return the request method used when submitting this form.
*/
public String getMethod() {
return (this.method);
}
/**
* Set the request method used when submitting this form.
*
* @param method The new request method
*/
public void setMethod(String method) {
this.method = method;
}
/**
* Return the onReset event script.
*/
public String getOnreset() {
return (this.onreset);
}
/**
* Set the onReset event script.
*
* @param onReset The new event script
*/
public void setOnreset(String onReset) {
this.onreset = onReset;
}
/**
* Return the onSubmit event script.
*/
public String getOnsubmit() {
return (this.onsubmit);
}
/**
* Set the onSubmit event script.
*
* @param onSubmit The new event script
*/
public void setOnsubmit(String onSubmit) {
this.onsubmit = onSubmit;
}
/**
* Return the style attribute for this tag.
*/
public String getStyle() {
return (this.style);
}
/**
* Set the style attribute for this tag.
*
* @param style The new style attribute
*/
public void setStyle(String style) {
this.style = style;
}
/**
* Return the style class for this tag.
*/
public String getStyleClass() {
return (this.styleClass);
}
/**
* Set the style class for this tag.
*
* @param styleClass The new style class
*/
public void setStyleClass(String styleClass) {
this.styleClass = styleClass;
}
/**
* Return the style identifier for this tag.
*/
public String getStyleId() {
return (this.styleId);
}
/**
* Set the style identifier for this tag.
*
* @param styleId The new style identifier
*/
public void setStyleId(String styleId) {
this.styleId = styleId;
}
/**
* Return the window target.
*/
public String getTarget() {
return (this.target);
}
/**
* Set the window target.
*
* @param target The new window target
*/
public void setTarget(String target) {
this.target = target;
}
/**
* Return the list of character encodings accepted.
*/
public String getAcceptCharset() {
return acceptCharset;
}
/**
* Set the list of character encodings accepted.
*
* @param acceptCharset The list of character encodings
*/
public void setAcceptCharset(String acceptCharset) {
this.acceptCharset= acceptCharset;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -