⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formcomponent.java

📁 structs源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * $Id: FormComponent.java 471754 2006-11-06 14:55:09Z husted $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.faces.component;


import java.util.Map;
import javax.faces.component.UIForm;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.servlet.http.HttpSession;
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.DynaActionFormClass;
import org.apache.struts.config.ActionConfig;
import org.apache.struts.config.FormBeanConfig;
import org.apache.struts.config.ModuleConfig;
import org.apache.struts.util.RequestUtils;


/**
 * <p><strong>FormComponent</strong> is a specialized subclass of
 * <code>javax.faces.component.UIForm</code> that supports automatic
 * creation of form beans in request or session scope.</p>
 *
 * @version $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $
 */
public class FormComponent extends UIForm {


    // -------------------------------------------------------- Static Variables


    /**
     * <p>The <code>Log</code> instance for this class.</p>
     */
    protected static Log log = LogFactory.getLog(FormComponent.class);


    // ------------------------------------------------------ Instance Variables


    private String action = null;
    private String enctype = null;
    private String focus = null;
    private String focusIndex = null;
    private String onreset = null;
    private String onsubmit = null;
    private String style = null;
    private String styleClass = null;
    private String target = null;


    // ---------------------------------------------------- Component Properties


    /**
     * <p>Return the Struts action path to which this form should be submitted.
     * </p>
     */
    public String getAction() {

        if (this.action != null) {
            return (this.action);
        }
        ValueBinding vb = getValueBinding("action");
        if (vb != null) {
            return ((String) vb.getValue(getFacesContext()));
        } else {
            return (null);
        }

    }


    /**
     * <p>Set the Struts action to which this form should be submitted.</p>
     *
     * @param action The new action path
     */
    public void setAction(String action) {

        this.action = action;

    }


    /**
     * <p>Return the encoding type for this form submit.</p>
     */
    public String getEnctype() {

        if (this.enctype != null) {
            return (this.enctype);
        }
        ValueBinding vb = getValueBinding("enctype");
        if (vb != null) {
            return ((String) vb.getValue(getFacesContext()));
        } else {
            return (null);
        }

    }


    /**
     * <p>Set the encoding type for this form submit.</p>
     *
     * @param enctype The new enctype path
     */
    public void setEnctype(String enctype) {

        this.enctype = enctype;

    }


    /**
     * <p>Return the component family to which this component belongs.</p>
     */
    public String getFamily() {

        return "org.apache.struts.faces.Form";

    }


    /**
     * <p>Return the focus element name.</p>
     */
    public String getFocus() {

        if (this.focus != null) {
            return (this.focus);
        }
        ValueBinding vb = getValueBinding("focus");
        if (vb != null) {
            return ((String) vb.getValue(getFacesContext()));
        } else {
            return (null);
        }

    }


    /**
     * <p>Set the focus element name.</p>
     *
     * @param focus The new focus path
     */
    public void setFocus(String focus) {

        this.focus = focus;

    }


    /**
     * <p>Return the focus element index.</p>
     */
    public String getFocusIndex() {

        if (this.focusIndex != null) {
            return (this.focusIndex);
        }
        ValueBinding vb = getValueBinding("focusIndex");
        if (vb != null) {
            return ((String) vb.getValue(getFacesContext()));
        } else {
            return (null);
        }

    }


    /**
     * <p>Set the focus element index.</p>
     *
     * @param focusIndex The new focusIndex path
     */
    public void setFocusIndex(String focusIndex) {

        this.focusIndex = focusIndex;

    }


    /**
     * <p>Return the JavaScript to execute on form reset.</p>
     */
    public String getOnreset() {

        if (this.onreset != null) {
            return (this.onreset);
        }
        ValueBinding vb = getValueBinding("onreset");
        if (vb != null) {
            return ((String) vb.getValue(getFacesContext()));
        } else {
            return (null);
        }

    }


    /**
     * <p>Set the JavaScript to execute on form reset.</p>
     *
     * @param onreset The new onreset path
     */
    public void setOnreset(String onreset) {

        this.onreset = onreset;

    }


    /**
     * <p>Return the JavaScript to execute on form submit.</p>
     */
    public String getOnsubmit() {

        if (this.onsubmit != null) {
            return (this.onsubmit);
        }
        ValueBinding vb = getValueBinding("onsubmit");
        if (vb != null) {
            return ((String) vb.getValue(getFacesContext()));
        } else {
            return (null);
        }

    }


    /**
     * <p>Set the JavaScript to execute on form submit.</p>
     *
     * @param onsubmit The new onsubmit path
     */
    public void setOnsubmit(String onsubmit) {

        this.onsubmit = onsubmit;

    }


    /**
     * <p>Return the CSS style(s) to be rendered for this component.</p>
     */
    public String getStyle() {

        ValueBinding vb = getValueBinding("style");
        if (vb != null) {
            return (String) vb.getValue(getFacesContext());
        } else {
            return style;
        }

    }


    /**
     * <p>Set the CSS style(s) to be rendered for this component.</p>
     *
     * @param style The new CSS style(s)
     */
    public void setStyle(String style) {

        this.style = style;

    }


    /**
     * <p>Return the CSS style class(es) to be rendered for this component.</p>
     */

⌨️ 快捷键说明

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