Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 88810 invoked from network); 1 Mar 2007 03:12:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Mar 2007 03:12:47 -0000 Received: (qmail 89183 invoked by uid 500); 1 Mar 2007 03:12:52 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 88934 invoked by uid 500); 1 Mar 2007 03:12:51 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 88923 invoked by uid 99); 1 Mar 2007 03:12:51 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 19:12:51 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of mkienenb@gmail.com designates 64.233.184.234 as permitted sender) Received: from [64.233.184.234] (HELO wr-out-0506.google.com) (64.233.184.234) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 19:12:40 -0800 Received: by wr-out-0506.google.com with SMTP id i21so500359wra for ; Wed, 28 Feb 2007 19:12:20 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bCRruUM9b0D2Z4RqMb2CZmbOKaC+Ki9fgCZzAJGHxmVxgnIaZjUbxnxEblQsJubIslefWQvoU9oyloZFSZdr6xT60b8acGWJ8IpBV97fgtT6k8zbr1Cr+QnG7XtvoHjj3M+6YgKRRj5NoSnof5CiyzfXVgTrHPWLPqFCa5753AA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UigABXCaHsBh7AwQEs9liPGpilq0hoTxOaSHLE3hUf3xAnTHH+MtHQJDvrxxdzkyp77Nys0u9HV72okJvELmFkhIbW7Cw80VAyBUFSXwWf3AthZH6EFTOxngvGM5zrP61aekXp34KPQzFYHeHYIykKfOVLnB2mTsbT9hlUenZlk= Received: by 10.114.137.2 with SMTP id k2mr69621wad.1172700266603; Wed, 28 Feb 2007 14:04:26 -0800 (PST) Received: by 10.114.200.8 with HTTP; Wed, 28 Feb 2007 14:04:26 -0800 (PST) Message-ID: <8f985b960702281404k2f8175d2g61029545930a6d8c@mail.gmail.com> Date: Wed, 28 Feb 2007 17:04:26 -0500 From: "Mike Kienenberger" To: "MyFaces Discussion" Subject: Re: sitemesh and jsf In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <45E48D6D.80805@rhe.co.nz> <45E4922B.60006@rhe.co.nz> X-Virus-Checked: Checked by ClamAV on apache.org Shawn, it probably makes the most sense for you to add it. On 2/28/07, Garner Shawn wrote: > Alright I found a solution here: > http://jira.opensymphony.com/browse/SIM-201 > Can somebody please add this to the MyFaces Wiki under the topic Sitemesh? > > Shawn > > On 2/27/07, Garner Shawn wrote: > > I did post on the Sitemesh users list. I haven't heard anything back yet. > > This list is much more active than the sitemesh list. > > > > Shawn > > > > On 2/27/07, Simon Kitching wrote: > > > > > > Well I guess you'll have to look at the source-code for the Sitemesh > > > PageFilter then, or ask on the Sitemesh list. The problem is clearly > > > that JSF-specific JSP tags are being executed but not within the scope > > > of a FacesServlet. That's not a MyFaces problem, so unfortunately you're > > > not likely to get much further help on this list. > > > > > > However if you do get this figured out it would be great if you could > > > post the solution here (or add a page to the wiki) for anyone who > > > encounters this in the future. > > > > > > Regards, > > > > > > Simon > > > > > > Garner Shawn wrote: > > > > I tried this and it didn't work but am unsure why: > > > > > > > > "ExternalContext.dispatch to execute the jsp servlet for processing its > > > > template so maybe it's just as simple as ensuring the decorators file > > > > for Sitemesh uses ".jsf" urls rather than ".jsp" urls to its template > > > > files, in order to trigger the FacesServlet rather than just the > > > > jsp-handler servlet?" > > > > > > > > I got close by overriding the sitemesh filter and then doing a > > > > chain.filter before calling the sitmesh filter. It rendered the page > > > > ok (not right) but it rendered the original page being decorated > > > > twice. Once at the beginning and then once later where it should have > > > > been in the page. > > > > > > > > > > > > Shawn > > > > On 2/27/07, Simon Kitching wrote: > > > >> The project I am currently working on uses Sitemesh with MyFaces, ie the > > > >> pages being *decorated* are JSF and it works. However the templates > > > >> themselves will need to be JSP only (not JSF) I believe; that's > > > >> certainly what we do. > > > >> > > > >> In order for a JSP page containing JSF tags to work correctly, the JSF > > > >> FacesServlet must handle it. The FacesServlet sets up some JSF > > > >> infrastructure on entry, then executes the JSP page (using > > > >> ExternalContext.dispatch). When JSF-specific tags execute the necessary > > > >> JSF infrastructure is therefore present. However on completion of the > > > >> servlet that infrastructure is destroyed by the FacesServlet. > > > >> > > > >> What the sitemesh *filter* does is initially pass the incoming request > > > >> through without change so the primary "decorated" page is fetched, then > > > >> it determines what decorator template to use and processes that > > > >> *itself*. Sitemesh sets up the environment for its template to be > > > >> correctly processed as jsp, but is not smart enough to set up the > > > >> necessary environment for any JSF tags to execute successfully. And as > > > >> described above the JSF-specific environment was set up on FacesServlet > > > >> entry, but removed on FacesServlet exit so it is no longer available. > > > >> > > > >> We work around that somewhat by defining a custom "proxyInclude" tag > > > >> which uses commons-httpclient to make requests. This tag can then be > > > >> embedded into a Sitemesh template to insert JSF-generated data (in > > > >> particular, a common header including a JsCookMenu menubar). > > > >> > > > >> Maybe the Sitemesh PageFilter could be improved to be JSF-aware but we > > > >> haven't done that. Hmm..presumably the PageFilter does something like > > > >> ExternalContext.dispatch to execute the jsp servlet for processing its > > > >> template so maybe it's just as simple as ensuring the decorators file > > > >> for Sitemesh uses ".jsf" urls rather than ".jsp" urls to its template > > > >> files, in order to trigger the FacesServlet rather than just the > > > >> jsp-handler servlet? > > > >> > > > >> Regards, > > > >> > > > >> Simon > > > >> > > > >> > > > >> Ricardo Tercero Lozano wrote: > > > >> > As far as I know you cannot use JSF in Sitemesh decorators. > > > >> > > > > >> > Ricardo. > > > >> > > > > >> > > > > >> > On 2/26/07, *Garner Shawn* > > >> > > wrote: > > > >> > > > > >> > I'm trying to use sitmesh with JSF and am getting the following > > > >> > exception: > > > >> > This is my template decorator page and has a f:view page. > > > >> > Is there something I have to do with this to initialize the > > > >> > FacesContext for the decorators/templates? > > > >> > > > > >> > > > > >> > javax.faces.FacesException: Faces context not found. > > > >> getResponseWriter > > > >> > will fail. Check if the FacesServlet has been initialized at all in > > > >> > your web.xml configuration fileand if you are accessing your > > > >> jsf-pages > > > >> > through the correct mapping. E.g.: if your FacesServlet is > > > >> mapped to > > > >> > *.jsf (with the -element), you need to access your > > > >> > pages as 'sample.jsf'. If you tried to access 'sample.jsp', > > > >> you'd get > > > >> > this error-message. > > > >> > javax.faces.webapp.UIComponentTag.setupResponseWriter > > > >> > (UIComponentTag.java:926) > > > >> > > > > >> > > > > >> javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:313) > > > >> > > > > >> > org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:73) > > > >> > > > > >> > org.apache.jsp.decorators.andreasTemplate_jsp._jspx_meth_f_view_0 > > > >> > (andreasTemplate_jsp.java:146) > > > >> > > > > >> > > > > >> org.apache.jsp.decorators.andreasTemplate_jsp._jspService(andreasTemplate_jsp.java:122) > > > >> > > > >> > > > > >> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) > > > >> > javax.servlet.http.HttpServlet.service > > > >> (HttpServlet.java:802) > > > >> > > > > >> > > > > >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) > > > >> > > > >> > > > > >> > > > > >> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) > > > >> > org.apache.jasper.servlet.JspServlet.service > > > >> > (JspServlet.java:264) > > > >> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > > > >> > > > > >> > > > > >> com.age.j.soft.sitemesh.TemplateFilterImpl.applyDecorator(TemplateFilterImpl.java:49) > > > >> > > > >> > com.opensymphony.module.sitemesh.filter.PageFilter.doFilter > > > >> > (PageFilter.java:62) > > > >> > > > > >> > > > > >> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144) > > > >> > > > >> > > > > >> > > > > >> > > > >> > > > > > > > > >