On Friday 16 September 2005 17:40, Sylvain COUTANT wrote:
> Hi,
>
> I'm fairly new to Tapestry, but I thought jwc files were to define
> components, not pages.
>
> For pages, I have no .page file. Tap 4 supports a package list
> (org.apache.tapestry.page-class-packages) to search for a java class having
> the same name as the page.
>
> For components, I didn't find how I could avoid the jwc file. It's required
> by the <component-type> element in application description ...
I'm fairly new to tapestry also, but I am creating my entire application (so
far) without needing any page or component specifications. The entire thing
is done with html templates and java classes.
Basically, my application is called famtree, and therefore in
WEB-INF/famtree.application file I have the following
<application name="famtree"
engine-class="org.apache.tapestry.engine.BaseEngine">
<description>Family tree</description>
<meta key="org.apache.tapestry.page-class-packages" >
uk.org.chandlerfamily.tapestry.famtree
</meta>
<meta key="org.apache.tapestry.component-class-packages">
uk.org.chandlerfamily.tapestry.components
</meta>
...
Which defines where it looks for both my pages and my components.
Each component class then looks a bit like the following example
package uk.org.chandlerfamily.tapestry.components;
import org.apache.tapestry.annotations.*;
import org.apache.tapestry.BaseComponent;
import java.util.List;
import uk.org.chandlerfamily.sqlmap.famtree.PersonSummary;
@ComponentClass
public abstract class Children extends BaseComponent {
@Parameter
public abstract List<PersonSummary> getChildList();
public abstract void setThisChild(PersonSummary thisChild);
public abstract PersonSummary getThisChild();
}
Where this defines a component called "Children" which will take a parameter
called "childList" and which has a @Foreach loop in the html template which
interate over the list and use "ognl:thisChild.someproperty to get a property
of the child.
Page files look a bit like
public abstract class Details extends BasePage implements PageValidateListener
{
public abstract int getPersonId();
public abstract void setPersonId(int personId);
public abstract Person getThisPerson();
public abstract void setThisPerson(Person thisPerson);
public void pageValidate (PageEvent event) {
... code to set up "thisPerson" data from a database with a paramter
"personId" passed in via a listener in another page which returns with this
page in its return statement.
}
}
--
Alan Chandler
http://www.chandlerfamily.org.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]