Load the given <code>form</code> into the {@link JspContext} object.  Because the
framework supports any bean action forms, the type of the form is {@link Object}
@param jspContext the jsp context
@param form the form object
432714
public static void loadActionForm(JspContext jspContext, Object form) {
        jspContext.setAttribute(ACTION_FORM_IMPLICIT_OBJECT_KEY, unwrapForm(form));
    }
298529
public static void populateForm(Form form, Object bean)
            throws IllegalAccessException, InvocationTargetException {

        // input tag
        try {
            for (Input input : form.getDescendants(Input.class)) {
                // name属性が指定されていない場合はスルーする。
                if (M2StringUtils.isBlank(input.getName())) {
                    continue;
                }

                switch (input.getType()) {
                case RADIO:
                    // radioは同じnameで複数個ありうるが、ひとつしか選択できない
                    String beanValue = BeanUtils.getProperty(bean,
                            input.getName());
                    if (input.getValue() != null
                            && input.getValue().equals(beanValue)) {
                        input.setChecked("checked");
                    } else {
                        input.setChecked(null);
                    }
                    break;
                case CHECKBOX:
                    // checkboxは同じnameで複数個ありうるし、複数選択できる
                    String[] beanValues = BeanUtils.getArrayProperty(bean,
                            input.getName());
                    boolean matchBean = false;
                    for (String value : beanValues) {
                        if (value.equals(input.getValue())) {
                            input.setChecked("checked");
                            matchBean = true;
                            continue;
                        }
                    }
                    // inputタグのvalueが、beanの配列の値のどれにもマッチしてない場合には
                    // チェックをはずす
                    if (!matchBean) {
                        input.setChecked(null);
                    }
                    break;
                default:
                    // radio,checkbox以外
                    input.setValue(BeanUtils.getProperty(bean, input.getName()));
                }
            }
        } catch (NoSuchMethodException e) {
            log.debug("bean property not found that match the input tag in form.");
        }

        // textarea
        try {
            for (Textarea textarea : form.getDescendants(Textarea.class)) {
                // name属性が指定されていない場合はスルーする。
                if (M2StringUtils.isBlank(textarea.getName())) {
                    continue;
                } else {
                    textarea.setContent(BeanUtils.getProperty(bean,
                            textarea.getName()));
                }
            }
        } catch (NoSuchMethodException e) {
            log.debug("bean property not found that match the textarea tag in form.");
        }

        // select
        try {
            for (Select select : form.getDescendants(Select.class)) {
                // name属性が指定されていない場合はスルーする。
                if (M2StringUtils.isBlank(select.getName())) {
                    continue;
                } else {
                    for (Option option : select.getDescendants(Option.class)) {
                        boolean matchBean = false;
                        for (String value : BeanUtils.getArrayProperty(bean,
                                select.getName())) {
                            if (value.equals(option.getValue())) {
                                option.setSelected("selected");
                                matchBean = true;
                            }
                        }
                        // optionタグのvalueが、beanの配列の値のどれにも
                        // マッチしてない場合にはチェックをはずす
                        if (!matchBean) {
                            option.setSelected(null);
                        }
                    }
                }
            }
        } catch (NoSuchMethodException e) {
            log.debug("bean property not found that match the option tag in select tag.");
        }
    }
924836
public PageContextImpl initialize(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp, String errorPageURL, boolean needsSession, int bufferSize,
	    boolean autoFlush, boolean isChild, boolean ignoreScopes) {
	parent = null;
	requestId = counter++;

	appListenerType = ApplicationListener.TYPE_NONE;
	this.ignoreScopes = ignoreScopes;

	ReqRspUtil.setContentType(rsp, "text/html; charset=" + config.getWebCharset().name());
	this.isChild = isChild;

	applicationContext = defaultApplicationContext;

	startTime = System.currentTimeMillis();
	thread = Thread.currentThread();

	this.req = new HTTPServletRequestWrap(req);
	this.rsp = rsp;
	this.servlet = servlet;

	// Writers
	if (config.debugLogOutput()) {
	    CFMLWriter w = config.getCFMLWriter(this, req, rsp);
	    w.setAllowCompression(false);
	    DebugCFMLWriter dcw = new DebugCFMLWriter(w);
	    bodyContentStack.init(dcw);
	    debugger.setOutputLog(dcw);
	}
	else {
	    bodyContentStack.init(config.getCFMLWriter(this, req, rsp));
	}

	writer = bodyContentStack.getWriter();
	forceWriter = writer;

	// Scopes
	server = ScopeContext.getServerScope(this, ignoreScopes);
	if (hasFamily) {
	    variablesRoot = new VariablesImpl();
	    variables = variablesRoot;
	    request = new RequestImpl();
	    _url = new URLImpl();
	    _form = new FormImpl();
	    urlForm = new UrlFormImpl(_form, _url);
	    undefined = new UndefinedImpl(this, getScopeCascadingType());

	    hasFamily = false;
	}
	else if (variables == null) {
	    variablesRoot = new VariablesImpl();
	    variables = variablesRoot;
	}
	request.initialize(this);

	if (config.mergeFormAndURL()) {
	    url = urlForm;
	    form = urlForm;
	}
	else {
	    url = _url;
	    form = _form;
	}
	// url.initialize(this);
	// form.initialize(this);
	// undefined.initialize(this);

	psq = config.getPSQL();

	fdEnabled = !config.allowRequestTimeout();

	if (config.getExecutionLogEnabled()) this.execLog = config.getExecutionLogFactory().getInstance(this);
	if (debugger != null) debugger.init(config);

	undefined.initialize(this);
	timeoutStacktrace = null;
	return this;
    }
302885
public ActionForm getFirstOutputForm( HttpServletRequest request )
    {
        if ( _outputForms == null || _outputForms.size() == 0 )
        {
            if ( _outputFormBeanType != null )
            {
                try
                {
                    if ( _log.isDebugEnabled() )
                    {
                        _log.debug( "Creating form bean of type " + _outputFormBeanType );
                    }
                    
                    ServletContext servletContext = InternalUtils.getServletContext( request );
                    ReloadableClassHandler rch = Handlers.get( servletContext ).getReloadableClassHandler();
                    Object formBean = rch.newInstance( _outputFormBeanType );
                    ActionForm wrappedFormBean = InternalUtils.wrapFormBean( formBean );
                    addOutputForm( wrappedFormBean );
                    return wrappedFormBean;
                }
                catch ( Exception e )
                {
                    _log.error( "Could not create form bean instance of " + _outputFormBeanType, e );
                }                
            }
            
            return null;
        }
        else
        {
            return ( ActionForm ) _outputForms.get( 0 );
        }
    }
422166
public void setPostForm(boolean postForm) {
		this.postForm = postForm;
		getConfig().setProperty(SPIDER_POST_FORM, Boolean.toString(postForm));
	}
1300877
@Override
	protected void submit(StaplerRequest req) throws ServletException, FormException {
		initSections();
		try {
            sections.rebuildHetero(req, req.getSubmittedForm(), Hudson
            		.getInstance().<SectionedViewSection, Descriptor<SectionedViewSection>>getDescriptorList(SectionedViewSection.class),
            		"sections");
        } catch (IOException e) {
            throw new FormException("Error rebuilding list of sections.", e, "sections");
        }
	}
1049480
public void setContext( AdapterContext context )
    {
        Object servletContext = context.getExternalContext();
        assert servletContext instanceof ServletContext : servletContext;
        _servletContext = ( ServletContext ) servletContext;
        _eventReporter = createEventReporter();
    }
226206
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Debug.logVerbose("[JdonFramework]--> enter ModelViewAction process ", module);
		intContext(this.getServlet().getServletContext());

		ModelForm modelForm = FormBeanUtil.getModelForm(actionMapping, actionForm, request);

		if ((UtilValidate.isEmpty(modelForm.getAction())) || modelForm.getAction().equalsIgnoreCase(ModelForm.CREATE_STR)) {
			Debug.logVerbose("[JdonFramework]--> enter create process ", module);
			modelForm.setAction(ModelForm.CREATE_STR);
			createViewPage.doCreate(actionMapping, modelForm, request);

		} else if (modelForm.getAction().equalsIgnoreCase(ModelForm.EDIT_STR)) {

			Debug.logVerbose("[JdonFramework]--> enter " + ModelForm.EDIT_STR + " process ", module);
			Object model = editeViewPage.getModelForEdit(actionMapping, modelForm, request, this.servlet.getServletContext());
			if (model == null) // not found the model
				return errorsForward(modelForm.getAction(), actionMapping, request);

		} else if (modelForm.getAction().equalsIgnoreCase(ModelForm.VIEW_STR)) {

			Debug.logVerbose("[JdonFramework]--> enter " + ModelForm.VIEW_STR + " process ", module);
			Object model = editeViewPage.getModelForEdit(actionMapping, modelForm, request, this.servlet.getServletContext());
			if (model == null) // not found the model
				return errorsForward(modelForm.getAction(), actionMapping, request);

		} else {// other regard as create
			Debug.logVerbose("[JdonFramework]-->action value not supported, enter create process2 ", module);
			modelForm.setAction(ModelForm.CREATE_STR);
			createViewPage.doCreate(actionMapping, modelForm, request);
		}
		Debug.logVerbose("[JdonFramework]--> push the jsp that forward name is '" + modelForm.getAction() + "'", module);
		return actionMapping.findForward(modelForm.getAction());
	}
50692
protected final Binding doBind(JComponent control, FormModel formModel, String formPropertyPath, Map context) {
        AbstractListBinding binding = createListBinding(control, formModel, formPropertyPath);
        Assert.notNull(binding);
        applyContext(binding, context);
        return binding;
    }
782403
public DialogPage addForm(Form form) {
		DialogPage page = createDialogPage(form);
		addPage(page);
		return page;
	}
620546
public int doStartTag() throws JspException
    {
        if (hasErrors())
            return SKIP_BODY;
        
        // Error out if there is a parent form
        if (getNearestForm() != null) {
            registerTagError(Bundle.getString("Tags_FormParentForm"), null);
        }

        // Look up the form bean name, scope, and type if necessary
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        ServletContext servletContext = pageContext.getServletContext();

        // find the beanName, beanType and beanScope
        lookupBeanScopeAndName(request, servletContext);
        if (hasErrors())
            return SKIP_BODY;

        // Generate the real name.  We generate it here so we can return it to any contained tags if
        // they need it.  If they access it, the most likely will cause the realName to be output
        if (_state.id != null) {
            _realName = getIdForTagId(_state.id);
        }
        else {
            String formId = FORM_ID + getNextId(request);
            _realName = getIdForTagId(formId);
        }

        // Store this tag itself as a page attribute
        pageContext.setAttribute(Constants.FORM_KEY, this, PageContext.REQUEST_SCOPE);

        // Locate or create the bean associated with our form
        int scope = PageContext.SESSION_SCOPE;
        if ("request".equals(_beanScope)) {
            scope = PageContext.REQUEST_SCOPE;
        }

        // setup the Bean
        Object bean = null;
        if (_beanName != null)
            bean = pageContext.getAttribute(_beanName, scope);
        if (bean == null) {
            if (_explicitBeanType) {
                // Backwards compatibility - use explicitly specified values
                try {
                    Handlers handlers = Handlers.get(pageContext.getServletContext());
                    bean = handlers.getReloadableClassHandler().newInstance(_beanType);
                    if (bean != null) {
                        ((ActionForm) bean).setServlet(_servlet);
                    }
                }
                catch (Exception e) {
                    registerTagError(Bundle.getString("Tags_FormNameBadType"), e);
                }
            }
            else {
                // New and improved - use the values from the action mapping
                
                // First, check to see if this is a page flow-scoped form bean.  If so, use the current value
                // from the member field in the page flow (or shared flow).
                if (_flowController != null) {
                    bean = _flowController.getFormBean(_mapping);
                }

                if (bean == null) {
                    bean = InternalUtils.createActionForm(_mapping, _appConfig, _servlet, servletContext);
                }
            }

            if (hasErrors())
                return SKIP_BODY;

            // Call the reset method if we have an ActionForm
            if (bean instanceof ActionForm) {
                ((ActionForm) bean).reset(_mapping, request);
            }
            if (bean != null) {
                pageContext.setAttribute(_beanName, bean, scope);
            }
        }
        if (bean != null) {
            pageContext.setAttribute(Constants.BEAN_KEY, bean, PageContext.REQUEST_SCOPE);
            ImplicitObjectUtil.loadActionForm(pageContext, bean);
        }
        
        // Create the action URL here, so child tags can access it.
        try {
            HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
            _extraHiddenParams = new LinkedHashMap/*<String, List<String>>*/();
            _actionUrl = rewriteActionURL(servletContext, request, response, _extraHiddenParams);
        }
        catch (URISyntaxException e) {
            // report the error...
            logger.error(Bundle.getString("Tags_URISyntaxException"));
            String s = Bundle.getString("Tags_Form_URLException",
                    new Object[]{_state.action, e.getMessage()});
            registerTagError(s, e);
        }

        // Continue processing this page
        return EVAL_BODY_BUFFERED;
    }
1368932
public static HttpServletRequest getRequest(JspContext jspContext) {
        PageContext pageContext = getPageContext(jspContext);
        return (HttpServletRequest)pageContext.getRequest();
    }
1270727
function form (request) {

    if (isFormData(request.body)) {
        request.headers.delete('Content-Type');
    } else if (isObject(request.body) && request.emulateJSON) {
        request.body = Url.params(request.body);
        request.headers.set('Content-Type', 'application/x-www-form-urlencoded');
    }

}
991564
protected function loadForm()
    {
        if (! $this->_form) {
            $options = array();

            if (\MUtil_Bootstrap::enabled()) {
                //$options['class'] = 'form-horizontal';
                $options['role'] = 'form';
            }

            $this->_form = $this->createForm($options);

            $this->addFormElements($this->_form);
        }
    }
1110685
protected ModelForm getModelForm(ModelHandler modelHandler, ActionForm actionForm, HttpServletRequest request) throws Exception {

		if (actionForm == null) {
			throw new Exception(" must define form-bean as 'action' name in struts-config.xml ");
		}
		ModelForm strutsForm = (ModelForm) actionForm;
		String action = strutsForm.getAction();
		if ((action == null) || (action.length() == 0))
			throw new Exception(" Need a field : <html:hidden property=action /> in jsp's form! ");

		return strutsForm;

	}
1062678
protected void doPostForm(String path, MultivaluedMap<String, String> formParams) throws ClientException {
        doPostForm(path, formParams, null);
    }
53733
protected function loadForm()
    {
        $form = $this->createForm();

        $bridge = $this->model->getBridgeFor('form', $form);

        $this->addFormElements($bridge, $this->model);

        $this->form = $bridge->getForm();
    }