【发布时间】:2015-06-04 14:09:35
【问题描述】:
我最近开始学习 Tapestry 框架。我正在关注有关创建自定义组件并在代码中使用它的书籍示例。由于某种原因,组件中的文本没有显示(我只看到 hello world 文本)。这是 .java 和 tml 文件:
public class Index
{
public Index() {
}
public String getHello()
{
return "Hello world!";
}
}
索引 tml:
<html xmlns:t="http://tapestry.apache.org/schema/
tapestry_5_3.xsd">
<head>
<title>Tapestry 5 Book</title>
</head>
<body>
<t:MyComponent/>
<h1> ${hello} </h1>
</body>
</html>
我的组件.java
public class MyComponent {
public String getStuff()
{
return "Random stuff";
}
}
我的组件.tml
<span> ${stuff} </span>
我还想说,.java 文件在它们对应的包中(main/java 中的页面和组件...),而 .tml 文件在它们对应的资源包中。我的问题是,为什么组件文本没有显示?
【问题讨论】: