我看到这样一个问题。就是在AAction中配置了一个AActionForm直接跳到BAction中。BAction中的BAction中的值和AActionForm值相同是怎么回事。求高手解释

解决方案 »

  1.   

    你看下你Action配值文件中是否配值了Attribute.且两个action中attribute值不一样。 public static ActionForm createActionForm(HttpServletRequest request,
            ActionMapping mapping, ModuleConfig moduleConfig, ActionServlet servlet) {
            // Is there a form bean associated with this mapping?
            String attribute = mapping.getAttribute();        if (attribute == null) {
                return (null);
            }        // Look up the form bean configuration information to use
            String name = mapping.getName();
            FormBeanConfig config = moduleConfig.findFormBeanConfig(name);        if (config == null) {
                log.warn("No FormBeanConfig found under '" + name + "'");            return (null);
            }        ActionForm instance =
                lookupActionForm(request, attribute, mapping.getScope());        // Can we recycle the existing form bean instance (if there is one)?
            if ((instance != null) && config.canReuse(instance)) {
                return (instance);
            }        return createActionForm(config, servlet);
        }private static ActionForm lookupActionForm(HttpServletRequest request,
            String attribute, String scope) {
            // Look up any existing form bean instance
            if (log.isDebugEnabled()) {
                log.debug(" Looking for ActionForm bean instance in scope '"
                    + scope + "' under attribute key '" + attribute + "'");
            }        ActionForm instance = null;
            HttpSession session = null;        if ("request".equals(scope)) {
                instance = (ActionForm) request.getAttribute(attribute);
            } else {
                session = request.getSession();
                instance = (ActionForm) session.getAttribute(attribute);
            }        return (instance);
        }Structs中处理ActonForm如上
      

  2.   

    跳转的时候出的问题,我估计跳转的时候数据也传递了.....就是request中的数据,
    可能是B和A中的字段相同,所以就相当于请求B了...
      

  3.   

    AActionForm 和 BActionForm 字段名字相同的话,是会出现这种问题