dev@jsftemplating.java.net

Re: JSFTemplating: I keep getting "com.sun.jsftemplating.layout.LayoutDefinitionException"

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Thu, 28 Sep 2006 12:04:00 -0700

Yes, there is a very easy way to include files. Here's an example:

file1 (header.jsf):

    <rave:whatever... >
    "more header stuff...

file2 (footer.jsf):

    "footer stuff, copyright, whatever...
    </rave:whatever>


file3 (somepage.jsf):

    #include "/header.jsf"

    "This is the main content for somepage.jsf

    #include "/footer.jsf"


This feature works with the XML and template formats. Individual
"include" files do not have to be well formed and the entire page can
still be validated with an XML parser. The including happens at the
stream level so it is transparent to the parser and even the rest of
JSFTemplating.

The real-time update feature is also available in JSFTemplating. It is
enabled by setting the "com.sun.jsftemplating.DEBUG=true" jvm option. If
you have any trouble turning this on, let me know.

I don't know of any feature that Facelets has that JSFTemplating
doesn't. One thing Facelets does do better is error message reporting.
It also has better documentation... although I hope to help address that.

Thanks,

Ken

Todd Patrick wrote:
> Ken:
>
> Thank you for the detail explanation. This is tremendous help!
>
> I picked Facelets for two reasons:
>
> 1.) The project is relatively large, thus including a standard header
> and menu is important.
>
> 2.) I can update the User Interface Live which is a real time saver.
>
> After seeing how JSFTemplating works, I wish it would work with
> Facelets, but I understand that it would be a large undertaking to do
> so...
>
> I believe I am at square one again. I have to use Facelets, unless there
> is a way to include files in JSFTemplating similar to Facelets?
>
> Thanks,
>
> --Todd
>
> -----Original Message-----
> From: Ken.Paulsen_at_Sun.COM [mailto:Ken.Paulsen_at_Sun.COM]
> Sent: Thursday, September 28, 2006 12:25 PM
> To: dev_at_jsftemplating.dev.java.net
> Subject: Re: JSFTemplating: I keep getting
> "com.sun.jsftemplating.layout.LayoutDefinitionException"
>
>
> This problem is b/c both facelets and JSFTemplating are installed in
> your application and both are trying to handle the request. This
> exception should be non-fatal in JSFTemplating and is warning you that
> it didn't recognize the page you requested (because it was a Facelets
> page). The ViewHandler should then delegate to another ViewHandler (the
> faces ViewHandler) and the page should display (unless there are other
> errors).
>
> To answer your question... the LayoutDefinitionManager instances are
> created automatically (by the LayoutDefinitionManger class itself). Only
> one LDM is needed per file format (2 are currently supported). A custom
> LDM can be provided via the servlet initParam:
> "LayoutDefinitionManagerImpl" .. this is *not* required or even
> recommended. Bot JSFTemplating file formats are supported
> out-of-the-box. The LDM instances are responsible for implementing a
> method called "accepts(String)" which is used to see if the LDM can
> handle a particular "viewId". The .faces requests that you are sending
> are not handled by either LDM b/c they are Facelets pages, not
> JSFTemplating pages.
>
> It would be interesting to write an LDM that handled Facetlets pages...
> that doesn't exist today, though, and would likely be a significant
> effort. You would also lose most of the benefits of Facelets (although
> you'd gain all the benefits of JSFTemplating -- many of which are
> identical benefits to Facelets).
>
> Ken
>
> Todd Patrick wrote:
>
>> How do I create a LayoutDefinitionManager?
>>
>> I've been looking at the JavaDocs at
>> https://jsftemplating.dev.java.net/nonav/javadoc/index.html and this
>> is somewhat confusing.
>>
>> Thanks,
>>
>> --Todd
>>
>>
>> com.sun.jsftemplating.layout.LayoutDefinitionException: No
>> LayoutDefinitionManager available for 'eaigft/eaigft.faces'. This may
>>
>
>
>> mean the file cannot be found, or is unrecognizable.
>> at
>> com.sun.jsftemplating.layout.LayoutDefinitionManager.getLayoutDefiniti
>> on
>> Manager(LayoutDefinitionManager.java:251)
>> at
>> com.sun.jsftemplating.layout.LayoutDefinitionManager.getLayoutDefiniti
>> on
>> (LayoutDefinitionManager.java:208)
>> at
>> com.sun.jsftemplating.layout.LayoutViewRoot.getLayoutDefinition(Layout
>> Vi
>> ewRoot.java:227)
>> at
>> com.sun.jsftemplating.layout.LayoutViewHandler.createView(LayoutViewHa
>> nd
>> ler.java:128)
>> at
>> com.sun.facelets.FaceletViewHandler.createView(FaceletViewHandler.java
>> :7
>> 82)
>> at
>> com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java
>> :1
>> 64)
>> at
>> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
>> at
>> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
>> at
>> javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
>> ca
>> tionFilterChain.java:237)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
>> lt
>> erChain.java:157)
>> at
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Fi
>> lt
>> erChainProxy.java:264)
>> at
>> org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(Filte
>> rS
>> ecurityInterceptor.java:107)
>> at
>> org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(Fil
>> te
>> rSecurityInterceptor.java:72)
>> at
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Fi
>> lt
>> erChainProxy.java:274)
>> at
>> org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTran
>> sl
>> ationFilter.java:110)
>> at
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Fi
>> lt
>> erChainProxy.java:274)
>> at
>> org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilt
>> er
>> (AnonymousProcessingFilter.java:125)
>> at
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Fi
>> lt
>> erChainProxy.java:274)
>> at
>> org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFi
>> lt
>> er(SecurityContextHolderAwareRequestFilter.java:81)
>> at
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Fi
>> lt
>> erChainProxy.java:274)
>> at
>> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcess
>> in
>> gFilter.java:217)
>> at
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Fi
>> lt
>> erChainProxy.java:274)
>> at
>>
>>
> org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:108)
>
>> at
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Fi
>> lt
>> erChainProxy.java:274)
>> at
>> org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(Re
>> me
>> mberMeProcessingFilter.java:142)
>> at
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Fi
>> lt
>> erChainProxy.java:274)
>> at
>> org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter
>> (H
>> ttpSessionContextIntegrationFilter.java:191)
>> at
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Fi
>> lt
>> erChainProxy.java:274)
>> at
>> org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java
>> :1
>> 48)
>> at
>> org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.ja
>> va
>> :90)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
>> ca
>> tionFilterChain.java:186)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
>> lt
>> erChain.java:157)
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
>> lv
>> e.java:214)
>> at
>> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
>> Co
>> ntext.java:104)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
>> :5
>> 20)
>> at
>> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardC
>> on
>> textValve.java:198)
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
>> lv
>> e.java:152)
>> at
>> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
>> Co
>> ntext.java:104)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
>> :5
>> 20)
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
>> va
>> :137)
>> at
>> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
>> Co
>> ntext.java:104)
>> at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
>> va
>> :118)
>> at
>> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
>> Co
>> ntext.java:102)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
>> :5
>> 20)
>> at
>>
>>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
>
>> java:109)
>> at
>> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
>> Co
>> ntext.java:104)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
>> :5
>> 20)
>> at
>> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
>> at
>>
>>
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
>
>> at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
>> 79
>> 9)
>> at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proces
>> sC
>> onnection(Http11Protocol.java:705)
>> at
>> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
>> 57
>> 7)
>> at
>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPo
>> ol
>> .java:683)
>> at java.lang.Thread.run(Thread.java:595)
>>
>> -----Original Message-----
>> From: Todd Patrick [mailto:Todd.Patrick_at_dtn.com]
>> Sent: Thursday, September 28, 2006 9:54 AM
>> To: dev_at_jsftemplating.dev.java.net
>> Subject: JSFTemplating: I keep getting
>> "com.sun.jsftemplating.layout.LayoutDefinitionException"
>>
>> I think I am close, but I keep returning the exception:
>>
>> com.sun.jsftemplating.layout.LayoutDefinitionException
>>
>> My .xhtml page is:
>>
>> <!DOCTYPE layoutDefinition SYSTEM "/jsftemplating/layout.dtd"> <html
>> xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:ui="http://java.sun.com/jsf/facelets"
>> xmlns:h="http://java.sun.com/jsf/html"
>> xmlns:f="http://java.sun.com/jsf/core"
>> xmlns:rave="http://www.sun.com/web/ui">
>> <ui:composition template="/common/template.xhtml">
>>
>> <ui:define name="title">Petro Admin: EAI/GFT</ui:define>
>>
>> <ui:define name="body">
>> <layoutDefinition>
>> <layout>
>> <component type="staticText" id="hello">
>> <option name="value"
>> value="Hello World!" />
>> </component>
>> </layout>
>> </layoutDefinition>
>> </ui:define>
>> </ui:composition>
>> </html>
>>
>> I tried using just straight rave components in the page such as:
>>
>> <rave:staticText text="Hello World!" />
>>
>> But that throws the same exception.
>>
>> Thoughts?
>>
>> Thanks,
>>
>> --Todd
>>
>>