Hi, I'm a new user of Tapestry. Looks great at first glance, but I'm
having some issues while trying to make a simple table. I can only find
snippets from Tapestry 3, so it's probably just a simple
misunderstanding of Tapestry 4's differences.
Specifically, each row of the table is a statistic on a file in a
particular folder. I'm generating these statistics once per deploy, and
creating a static Vector of POJOs, each representing a row of this
table.
I tried the following simplification, which should just render one row
and one column, but I got a Tapestry error: Unable to read OGNL
expression '<parsed OGNL expression>' of [EMAIL PROTECTED]:
epitopeItems.
Then I tried adding a <property name="epitopeItems"/> to my Home.page,
and I got a Hivemind error: "Either the tableModel parameter or both
source and columns parameters must be specified by component
Home/table.tableView".
What could I be doing wrong?
Home.html:
<html>
<head>
</head>
<body>
<table jwcid="table"/>
</body>
</html>
Home.page:
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification class="edu.sdsc.iedb.epitope.samplePages.Home">
<description>add a description</description>
<asset name="stylesheet" path="css/style.css"/>
<component id="table" type="contrib:Table">
<binding name="source" value="ognl:epitopeItems"/>
<binding name="columns" value="literal:PdbId"/>
</component>
</page-specification>
Home.java:
public class Home extends BasePage {
private static String dataPath = null; // from the
properties file.
private static Vector items = null;
public Vector getItems() {
Vector items = new Vector();
EpitopeItem item = new EpitopeItem("blah");
epitopeItems.add(item);
return items;
}
}
EpitopeItem.java:
public class EpitopeItem implements Serializable {
private final String pdbId;
public EpitopeItem(String pdbId) {
super();
this.pdbId = pdbId;
}
public String getPdbId() {
return this.pdbId;
}
}
Test.application:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<!-- generated by Spindle, http://spindle.sourceforge.net -->
<application name="Test"
engine-class="org.apache.tapestry.engine.BaseEngine">
<description>add a description</description>
<library id="contrib"
specification-path="/org/apache/tapestry/contrib/Contrib.library"/>
<page name="Home" specification-path="Home.page"/>
</application>
Web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>Test</servlet-name>
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/app</url-pattern>
</servlet-mapping>
</web-app>