如何将块寻址到从库加载的Tapestry布局组件?
我的项目分为两个子项目。一个是组件库,第二个是实现页面和内容的主要部分 布局组件使用块和委托来实现某些动态特性。诸如此类:如何将块寻址到从库加载的Tapestry布局组件?,tapestry,Tapestry,我的项目分为两个子项目。一个是组件库,第二个是实现页面和内容的主要部分 布局组件使用块和委托来实现某些动态特性。诸如此类: <!DOCTYPE html> <!-- myLayout template --> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapes
<!DOCTYPE html>
<!-- myLayout template -->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="SHORTCUT ICON" href="favicon.ico"/>
<title>${title}</title>
</head>
<body>
<div class="tbar">
<t:delegate to="toolbar"/>
</div>
<t:body/>
</body>
</html>
${title}
我的页面以如下方式包含布局:
<?xml version="1.0"?>
<!-- Index.tml -->
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter"
xmlns:mylib="tapestry-library:myLib"
mylib:type="myLayout">
<p:toolbar>
<ul class="tbuttons">
<li>
<t:pagelink page="exp/index" class="tbutton">
<img src="${context:}/static/pic/print.png"/>
</t:pagelink>
</li>
</ul>
</p:toolbar>
</html>
如果我运行我的项目并尝试访问该站点,则会出现以下错误:
分析模板类路径失败:**/Index.tml:块参数仅允许直接在组件元素中使用
如果我将布局从库移到主应用程序项目中,整个构造工作正常
有人有想法吗?您对ComponentClassResolver有贡献吗?它在没有名称空间别名的情况下工作吗 要么:
<html
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter"
t:type="mylib/myLayout"
>
<p:toolbar>...</p:toolbar>
</html>
...
或
...
关于组件库的完整文档。您声明
xmlns:mylib=“tapestry library:mylib”
但随后引用mylib:type=“myLayout”
(注意大写字母“L”对“L”)@LanceJava您是对的,我将编辑这个问题,但我担心这只是我这里的问题中的键入问题。我为这个问题准备了真正的代码。你有这样的配置吗?我有。你给我指出了正确的方向。错误消息的原因是找不到组件。。。但您的代码片段不正确。我需要声明:t:type=“mylib/myLayout”(“.vs”“/”)
<t:mylib.mylayout
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter"
>
<p:toolbar>...</p:toolbar>
</t:mylib.mylayout>