Return-Path: Delivered-To: apmail-shale-issues-archive@locus.apache.org Received: (qmail 56404 invoked from network); 3 Nov 2007 03:33:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Nov 2007 03:33:01 -0000 Received: (qmail 55940 invoked by uid 500); 3 Nov 2007 03:32:49 -0000 Delivered-To: apmail-shale-issues-archive@shale.apache.org Received: (qmail 55916 invoked by uid 500); 3 Nov 2007 03:32:49 -0000 Mailing-List: contact issues-help@shale.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@shale.apache.org Delivered-To: mailing list issues@shale.apache.org Received: (qmail 55904 invoked by uid 99); 3 Nov 2007 03:32:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2007 20:32:48 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Nov 2007 03:33:00 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 43EF071418F for ; Fri, 2 Nov 2007 20:32:40 -0700 (PDT) Message-ID: <13517665.1194060760265.JavaMail.jira@brutus> Date: Fri, 2 Nov 2007 20:32:40 -0700 (PDT) From: "Paul Rivera (JIRA)" To: issues@shale.apache.org Subject: [jira] Created: (SHALE-476) prerender not called for SESSION Scope ViewControllers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org prerender not called for SESSION Scope ViewControllers ------------------------------------------------------ Key: SHALE-476 URL: https://issues.apache.org/struts/browse/SHALE-476 Project: Shale Issue Type: Bug Components: View Affects Versions: 1.0.4 Environment: Windows XP, Tomcat 6.6., Java 5, Eclipse 3.3 Reporter: Paul Rivera Hi, If you set your ViewController to anything other than REQUEST scope, your prerender() method does not get called. Below is a code snippet from the ViewPhaseListener.beforeRenderResponse(PhaseEvent event) method: [code] Map map = event.getFacesContext().getExternalContext().getRequestMap(); String viewName = (String) map.get(FacesConstants.VIEW_NAME_RENDERED); if (viewName == null) { return; } Object vc = map.get(viewName); //--> only gets from the RequestMap if (vc == null) { return; } try { getViewControllerCallbacks(event.getFacesContext()).prerender(vc); } catch (Exception e) { handleException(event.getFacesContext(), e); } map.remove(FacesConstants.VIEW_NAME_RENDERED); [/code] In the code above, it vc is only looked-up in the request map. It doesn't look into the session map nor in the application map anymore. Here is my proposed fix: [code] Map map = event.getFacesContext().getExternalContext().getRequestMap(); String viewName = (String) map.get(FacesConstants.VIEW_NAME_RENDERED); if (viewName == null) { return; } Object vc = map.get(viewName); //Check if the view is in the session scope. Session scope attributes //will be prioritized over Application scope attributes. /* if (vc == null) { map = event.getFacesContext().getExternalContext().getSessionMap(); vc = map.get(viewName); } //If the attribute is not in the Session scope, check if it is in the //Application scope. if (vc == null) { map = event.getFacesContext().getExternalContext().getApplicationMap(); vc = map.get(viewName); }*/ if (vc == null) { return; } try { getViewControllerCallbacks(event.getFacesContext()).prerender(vc); } catch (Exception e) { handleException(event.getFacesContext(), e); } map.remove(FacesConstants.VIEW_NAME_RENDERED); [/code] I've been using shale-view-1.0.4.jar with the fix in my web application and things look good so far. Please let me know if this is really a bug. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.