I seem to be having an issue doing this, and have read several places that say
it can be done. Everything is fine with the Home.page present (picks up the
properties, etc), but as soon as I remove the file, I get the "Page 'Home' not
found in namespace" error. I don't know if the entry in publicweb.application
is correct or not, but it appeared to be right according to the examples that I
saw. This is Tapestry 4.0-rc-3, and JBoss 4.0.3, Java 1.5.0_b3. I am trying
to use annotations only, and avoid the use of a 3rd file (.java, .html and
.page) if possible.
My current setup is as follows:
Directory Structure:
WEB-INF
|_ classes
|_ ca
|_ digitalperversion
|_ publicweb
|_ pages
|_ Home.java
|_ Home.html
|_ Home.properties
|_ Home.page
|_ publicweb.application
|_ web.xml
Home.html:
<html>
<head>
<title><span jwcid="@Insert" value="ognl:pageTitle">Title</span></title>
</head>
Hello World!
</html>
Home.java:
package ca.digitalperversion.publicweb.pages;
import org.apache.tapestry.annotations.Message;
import org.apache.tapestry.html.BasePage;
import ca.tripcentral.badger.dao.ServerDao;
public abstract class Home extends BasePage {
@Message
public abstract String getPageTitle();
}
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 />
Home.properties:
page-title=Home Title
publicweb.application:
<?xml version="1.0"?>
<!DOCTYPE application PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<application name="Public Website">
<meta key="org.apache.tapestry.page-class-packages"
value="ca.digitalperversion.publicweb.pages"/>
<library id="contrib"
specification-path="classpath:/org/apache/tapestry/contrib/Contrib.library"/>
</application>
web.xml:
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/TR/xmlschema-1/"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Public Web</display-name>
<servlet>
<servlet-name>publicweb</servlet-name>
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>publicweb</servlet-name>
<url-pattern>/app</url-pattern>
</servlet-mapping>
</web-app>
Thanks,
-mike