public ActionForm getActionForm() { // Is there a mapping associated with this request? ActionMapping mapping = getMapping(); if (mapping == null) return (null); // Is there a form bean associated with this mapping? String attribute = mapping.getAttribute(); if (attribute == null) return (null); // Look up the existing form bean, if any ActionForm instance = null; if ("request".equals(mapping.getScope())) { instance = (ActionForm) this.request.getAttribute(attribute); } else { instance = (ActionForm) this.session.getAttribute(attribute); } return instance; }
private static ActionMapping getPropertyActionMapping(String propertyName, ActionMapping mapping) { if (BindingUtil.isActionFormProperty(propertyName, mapping)) { return mapping; } // // FormBeanに対して複数のActionMappingが登録されている場合 // すべてのScopeが一致していた場合は、最初の1つのActionMappingを返却し // Exportするための情報として利用する // Scopeが異なる場合は、Scopeの設定優先順位は request > session としているため // requestスコープのActionMappingを優先して返却し // Exportするための情報として利用する // ActionMapping result = null; ActionConfig[] configs = ModuleConfigUtil.findActionConfigsForFormBeanName(propertyName); if (configs.length == 0) { return null; } result = (ActionMapping) configs[0]; for (int i = 1; i < configs.length; i++) { if (!(result.getScope().equals(configs[i].getScope()))) { if (result.getScope().equals("request")) { return result; } else { return (ActionMapping) configs[i]; } } } return result; }
beanScope = mapping.getScope(); beanType = formBeanConfig.getType();
public boolean execute(ActionContext actionContext) throws Exception { ActionConfig actionConfig = actionContext.getActionConfig(); String name = actionConfig.getName(); if (name == null) { return false; } FormBeanConfig formBeanConfig = actionConfig.getModuleConfig().findFormBeanConfig(name); if (formBeanConfig == null) { return false; } Map scope = actionContext.getScope(actionConfig.getScope()); Object instance = scope.get(actionConfig.getAttribute()); if (instance == null) { return false; } if (instance instanceof ActionForm) { return false; } BeanValidatorForm form = BeanValidatorFormUtil.toBeanValidatorForm(null, instance); scope.put(actionConfig.getAttribute(), form); return false; }
public boolean execute(ActionContext actionContext) throws Exception { ActionForm form = actionContext.getActionForm(); if (form instanceof S2BeanValidatorForm) { return false; } if (!(form instanceof BeanValidatorForm)) { return false; } ActionForm newForm = new S2BeanValidatorForm((BeanValidatorForm) form); if (actionContext instanceof ServletActionContext) { ServletActionContext sac = (ServletActionContext) actionContext; newForm.setServlet(sac.getActionServlet()); } ActionConfig actionConfig = actionContext.getActionConfig(); Map scope = actionContext.getScope(actionConfig.getScope()); actionContext.setActionForm(newForm); scope.put(actionConfig.getAttribute(), newForm); return false; }
ActionForm instance = lookupActionForm(request, attribute, mapping.getScope());
Map scope = actionCtx.getScope(actionConfig.getScope());
effectiveScope = actionConfig.getScope(); } else { effectiveFormName = this.getFormName();