I have several different projects that basically use the same javascript / css and layout template. I want to move all this into my tapestry-common-lib project and reference it from there.
I have other common components in my -common-lib tapestry, but it doesn't seem to be able to set up the layout correctly.
In my tapestry-common-lib project, I have CommonLayout.java in com.company.tapestrylib.components and a CommonLayout.tml file in the com/company/tapestrylib/components section.
I am trying to reference the CommonLayout form of another project in my Index.tml like this:
<t:commonlayout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> </t:commonlayout>
However, when I access this page, I get
Unable to resolve 'commonlayout' to a component class name.
Can I do it? Can I also put all my common css and javascript in the jar tapestry-common-lib and reference them from there using, for example:
<script type="text/javascript" src="${asset:context:/js/jquery-1.4.2.js}"></script>
I looked around and found a lot of articles about creating custom components and component libraries, but did not use reusable layouts, as I am trying to do.
UPDATE:
I am currently using other abstract components from my component library. They are stored in [root] .tapestrylib.base.
I am trying to save my general layout (Layout.java and Layout.tml) in [root] .tapestrylib.components. When I try to reference this layout from my other project, I get
Unable to resolve 'layout' to a component class name.
I am trying to use it like this:
<html t:type="tapestry-lib/layout" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter"> </html>
This is part of the actual exception that I get:
11:28:01 ERROR RequestExceptionHandler - Processing of request failed with uncaught exception: Unable to resolve 'tapestry-lib/layout' to a component class name. org.apache.tapestry5.ioc.internal.OperationException: Unable to resolve 'tapestry-lib/layout' to a component class name. [at classpath:com/mycompany/webapp/pages/Index.tml, line 1] at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:102) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:69) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1057) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:218) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:208) at org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:180) at org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:174) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1057) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:173) at $PageLoader_12d045be613.loadPage($PageLoader_12d045be613.java)