[ 
https://issues.apache.org/jira/browse/WW-3451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870368#action_12870368
 ] 

zhouyanming commented on WW-3451:
---------------------------------

I presume you are coping code from line 315 

            ServletContextHashModel servletContextModel = 
(ServletContextHashModel) servletContext.getAttribute(ATTR_APPLICATION_MODEL);
            if (servletContextModel == null) {
                // first try a JSP support servlet.  If it fails, default to 
the servlet.
                GenericServlet servlet = JspSupportServlet.jspSupportServlet;
                if (servlet != null) {
                    servletContextModel = new ServletContextHashModel(servlet, 
wrapper);
                    servletContext.setAttribute(ATTR_APPLICATION_MODEL, 
servletContextModel);
                } else {
                    servletContextModel = new 
ServletContextHashModel(servletContext, wrapper);
                    servletContext.setAttribute(ATTR_APPLICATION_MODEL, 
servletContextModel);
                }
                TaglibFactory taglibs = new TaglibFactory(servletContext);
                servletContext.setAttribute(ATTR_JSP_TAGLIBS_MODEL, taglibs);
            }
            model.put(KEY_APPLICATION, servletContextModel);
            model.putUnlistedModel(KEY_APPLICATION_PRIVATE, 
servletContextModel);

but your code :

HttpSessionHashModel sessionModel;
        if (session != null) {
            sessionModel = (HttpSessionHashModel) 
session.getAttribute(ATTR_SESSION_MODEL);
            if (sessionModel == null) {
                sessionModel = new HttpSessionHashModel(session, wrapper);
                session.setAttribute(ATTR_SESSION_MODEL, sessionModel);
            }
            model.put(KEY_SESSION, new HttpSessionHashModel(session, wrapper));
        } else {
            // no session means no attributes ???
            //            model.put(KEY_SESSION_MODEL, new SimpleHash());
        }

I think you want 
 model.put(KEY_SESSION, sessionModel);
not
 model.put(KEY_SESSION, new HttpSessionHashModel(session, wrapper));


you recommended to use a filter remove such unnecessary object is a crappy 
suggestion,nobody want be responsible for this immature design.
I redeclare put unnecessary object into session is evil,particularly in 
distributed or cluster system.



> [FreemarkerManager]  don't put ATTR_SESSION_MODEL into session  
> ----------------------------------------------------------------
>
>                 Key: WW-3451
>                 URL: https://issues.apache.org/jira/browse/WW-3451
>             Project: Struts 2
>          Issue Type: Bug
>            Reporter: zhouyanming
>            Priority: Critical
>         Attachments: patch.txt
>
>
> put ATTR_SESSION_MODEL into session is useless in current code, and harmful 
> for  distributed system
> and remove some other useless code,please see patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to