| Method from org.apache.struts2.components.Form Detail: |
protected void evaluateExtraParams() {
super.evaluateExtraParams();
//boolean isAjax = "ajax".equalsIgnoreCase(this.theme);
if (validate != null) {
addParameter("validate", findValue(validate, Boolean.class));
}
// calculate the action and namespace
/*String action = null;
if (this.action != null) {
// if it isn't specified, we'll make somethig up
action = findString(this.action);
}
if (Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) {
evaluateExtraParamsPortletRequest(namespace, action);
} else {
String namespace = determineNamespace(this.namespace, getStack(),
request);
evaluateExtraParamsServletRequest(action, namespace, isAjax);
}*/
if (onsubmit != null) {
addParameter("onsubmit", findString(onsubmit));
}
if (target != null) {
addParameter("target", findString(target));
}
if (enctype != null) {
addParameter("enctype", findString(enctype));
}
if (method != null) {
addParameter("method", findString(method));
}
if (acceptcharset != null) {
addParameter("acceptcharset", findString(acceptcharset));
}
// keep a collection of the tag names for anything special the templates might want to do (such as pure client
// side validation)
if (!parameters.containsKey("tagNames")) {
// we have this if check so we don't do this twice (on open and close of the template)
addParameter("tagNames", new ArrayList());
}
}
|
protected boolean evaluateNameValue() {
return false;
}
|
public String getDefaultOpenTemplate() {
return OPEN_TEMPLATE;
}
|
protected String getDefaultTemplate() {
return TEMPLATE;
}
|
protected int getSequence() {
return sequence++;
}
Get a incrementing sequence unique to this Form component.
It is used by Form component's child that might need a
sequence to make them unique. |
public List getValidators(String name) {
Class actionClass = (Class) getParameters().get("actionClass");
if (actionClass == null) {
return Collections.EMPTY_LIST;
}
List< Validator > all = ActionValidatorManagerFactory.getInstance().getValidators(actionClass, (String) getParameters().get("actionName"));
List< Validator > validators = new ArrayList< Validator >();
for (Validator validator : all) {
if (validator instanceof FieldValidator) {
FieldValidator fieldValidator = (FieldValidator) validator;
if (fieldValidator.getFieldName().equals(name)) {
validators.add(fieldValidator);
}
}
}
return validators;
}
|
protected void populateComponentHtmlId(Form form) {
boolean isAjax = "ajax".equalsIgnoreCase(this.theme);
String action = null;
if (this.action != null) {
// if it isn't specified, we'll make somethig up
action = findString(this.action);
}
if (id != null) {
addParameter("id", escape(id));
}
// if no id given, it will be tried to generate it from the action attribute in the
// corresponding evaluateExtraParams method
if (Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) {
evaluateExtraParamsPortletRequest(namespace, action);
} else {
String namespace = determineNamespace(this.namespace, getStack(),
request);
evaluateExtraParamsServletRequest(action, namespace, isAjax);
}
}
The Form component determines its HTML element id as follows:-
- if an 'id' attribute is specified.
- if an 'action' attribute is specified, it will be used as the id.
|
public void setAcceptcharset(String acceptcharset) {
this.acceptcharset = acceptcharset;
}
|
public void setAction(String action) {
this.action = action;
}
|
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
}
|
public void setEnableDynamicMethodInvocation(String enable) {
enableDynamicMethodInvocation = "true".equals(enable);
}
|
public void setEnctype(String enctype) {
this.enctype = enctype;
}
|
public void setMethod(String method) {
this.method = method;
}
|
public void setNamespace(String namespace) {
this.namespace = namespace;
}
|
public void setObjectFactory(ObjectFactory objectFactory) {
this.objectFactory = objectFactory;
}
|
public void setOnsubmit(String onsubmit) {
this.onsubmit = onsubmit;
}
|
public void setPortletMode(String portletMode) {
this.portletMode = portletMode;
}
|
public void setTarget(String target) {
this.target = target;
}
|
public void setValidate(String validate) {
this.validate = validate;
}
|
public void setWindowState(String windowState) {
this.windowState = windowState;
}
|