?? formcomponent.java
字號:
/*
* Copyright 2002-2004 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.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: 54943 $ $Date: 2004-10-17 00:57:37 +0100 (Sun, 17 Oct 2004) $
*/
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>
*/
public String getStyleClass() {
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -