I am a new Tapestry user and enjoying the time coding in it - but having a
few problems.


*Summary of the Problem:
*--------
Pages work fine. Custom Components, not so well.


*Tools:*
--------
Using Eclipse Ganymede 3.4.0 (1.6 compliance) with WTP and m2 MAVEN plugin
Netbeans 6.1 and native MAVEN support
Using Tomcat 6.0.16
Using JDK 1.6.0_06
Using Maven (m2 plugin with eclipse,native support in Netbeans, command line
manually deploy as well).
pom.xml in all cases includes the clause to package class files to a jar and
include in the lib directory as described on the website for tomcat. This is
not adhered to in the Eclipse WTP framework - so I tried it multiple ways.


*Details of the Problem:*
--------
1. I can successfully get a simple build working great. I can create
home.tml in the src/main/webapp directory and that automatically ties into
the defined **.pages.Home.java class.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";
lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/>
        <title>Home</title>
    </head>
    <body>
        <h1>Home</h1>
        <ul>
            <li><t:pageLink page="about">About</t:pageLink></li>
            <li><t:pageLink page="contact">Contact</t:pageLink></li>
        </ul>
    </body>
</html>


2. I think create two other pages and their corresponding java classes
(home.tml, about.tml, contact.tml). Both Eclipse WTP and Netbeans native
deployments work with this.


3. Now the problem. I create **.components.Wrapper.java. I create
src/main/resources/**/components/wrapper.tml.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";
lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/>
        <title>Wrapper</title>
    </head>
    <body>
        <t:body/>
    </body>
</html>


and I alter contact.tml to use the new component:

<t:wrapper xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";
lang="en">
        <h1>Contact</h1>
        <ul>
            <li><t:pageLink page="home">Home</t:pageLink></li>
            <li><t:pageLink page="about">About</t:pageLink></li>
        </ul>
</t:wrapper>

I create the appropriately packaged Wrapper.java (**.components). This
package directly matches the package where the wrapper.tml file is located.
The wrapper.tml is in the MAVEN src/main/resources while the Java class is
physically in src/main/java.

// $Id$
package website.web.components;

public class Wrapper
{

}


I run this and http://localhost:8080/home works great. Home's like to
"about" works great: http://localhost:8080/about. But when I finally click
on "contact" - I literally see this in the browser (view source):

<ul><li><a href="home">Home</a></li><li><a href="about">About</a></li></ul>


It is not correctly instantiating the component. Nothing about "wrapper" is
getting used.

I have this in Eclipse, Netbeans and even deployed directly tomcat manually
from a MAVEN build:

  <build>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                  <source>1.6</source>
                  <target>1.6</target>
                  <optimize>true</optimize>
              </configuration>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-war-plugin</artifactId>
              <configuration>
                  <archiveClasses>true</archiveClasses>
              </configuration>
          </plugin>
      </plugins>
  </build>

And still - that component is just not getting picked up.

If I change the name of the component class (Wrapper.java -> Trapper.java)
then I correctly get a well written error saying:

An unexpected application exception has occurred.

Render queue error in BeginRender[Home:pagelink_0]: Unable to resolve
'wrapper' to a component class name. Available component types: ActionLink,
AddRowLink, AjaxFormLoop, Any, BeanDisplay, BeanEditForm, BeanEditor,
Checkbox, DateField, Delegate, Errors, EventLink, ExceptionDisplay, Form,
FormFragment, FormInjector, Grid, GridCell, GridColumns, GridPager,
GridRows, If, Label, Loop, Output, OutputRaw, PageLink, Palette,
PasswordField, PropertyDisplay, PropertyEditor, Radio, RadioGroup,
RemoveRowLink, RenderObject, Select, Submit, SubmitNotifier, TextArea,
TextField, TextOutput, Trapper, Unless, Zone.


If I rename the template file "wrapper.tml" to some other nonsense, the
system doesn't seem to care. No exception or different behavior pops up. So
- I think the problem is that the class cannot find or doesn't look for the
template file. I guess this is consistent with the tomcat specific
instructions provided on the tapestry5 website - but I did indeed confirm
that both are present in the manual maven build - in the lib directy in an
application JAR file and still no luck.

Thoughts?

Thanks in advance,

-Luther



I wouldn't mind helping out on this if I can. I loaded the source and trying
to follow it - but at the moment - I'm a bit spun around. I really think
Tapestry needs to support the Eclipse-WTP/tomcat build environment out of
the box. I have to think that alot of folks are standardizing on that
toolset for local development and debugging.

Reply via email to