You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andrew Kelly <an...@progmatics.com.au> on 2006/02/14 05:39:49 UTC
Including boilerplate in .page files
I have several .page files that all look like:
<?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>
<!-- page-specific stuff goes here... -->
<!-- here is the common stuff -->
<property name="currField"/>
<component id="errors" type="For">
<binding name="source" value="beans.delegate.fieldTracking"/>
<binding name="value" value="currField"/>
</component>
<component id="error" type="Delegator">
<binding name="delegate" value="currField.errorRenderer"/>
</component>
<component id="isInError" type="If">
<binding name="condition" value="currField.inError"/>
</component>
</page-specification>
If I move the common stuff into a file (showErrors.txt), how can I then
"include" it in each .page file?
As suggested elsewhere, I've already tried:
<include xlink:href="showErrors.txt">
and also:
<page-specification xmlns:xi="http://www.w3.org/2001/XInclude">
...
<xi:include href="showErrors.txt" parse="text"/>
Neither of these worked.
There must be an easy way....
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Including boilerplate in .page files
Posted by Ron Piterman <rp...@gmx.net>.
you can either create a component which renders those, usually inside
your border (layout) component.
or, (quite dirty IMHO...) , use an xml entity...
or, create the components using an annotation in an interface and let
your page classes implement the interface.
no. 1 is the *absolute* *preffered* one, but in some rare cases one
could use 2 or 3.
cheers,
Ron
Andrew Kelly wrote:
> I have several .page files that all look like:
>
> <?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>
> <!-- page-specific stuff goes here... -->
>
> <!-- here is the common stuff -->
> <property name="currField"/>
>
> <component id="errors" type="For">
> <binding name="source" value="beans.delegate.fieldTracking"/>
> <binding name="value" value="currField"/>
> </component>
> <component id="error" type="Delegator">
> <binding name="delegate" value="currField.errorRenderer"/>
> </component>
> <component id="isInError" type="If">
> <binding name="condition" value="currField.inError"/>
> </component>
> </page-specification>
>
> If I move the common stuff into a file (showErrors.txt), how can I then
> "include" it in each .page file?
>
> As suggested elsewhere, I've already tried:
>
> <include xlink:href="showErrors.txt">
>
> and also:
>
> <page-specification xmlns:xi="http://www.w3.org/2001/XInclude">
> ...
> <xi:include href="showErrors.txt" parse="text"/>
>
> Neither of these worked.
>
> There must be an easy way....
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org