Hi all,

when I had to rework an older (Tap3, annotation-free) application I stumbled
over repetitive declaration of delegate & validator beans and base-class
properties.

My solution, which I wanted to share, is this:
  1. put the duplicate xml-code into a separate file.
  2. refer to that file from .page files via a custom entity

Example for 1.:

#################### FILE: delegateStuff.txt #################

<bean name="delegate"
class="com.bmw.extranet.webkit.dialog.valid.WebkitDelegate" 
             lifecycle="request"/>

<bean name="requiredValidator"
class="org.apache.tapestry.valid.StringValidator"
        lifecycle="page"> 
        <set-property name="clientScriptingEnabled"  expression="true"/>
        <set-property name="required" expression="true"/>
    </bean>
############################################################


Example for 2. 

##################### some .page file #######################
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"; 
   [
        <!ENTITY delegate SYSTEM "delegateStuff.txt" >
        ]>
 

 <component id="dirtyCheck1" type="DirtyFormWarning">
        <binding name="form" expression="components.mainForm"/>
        <message-binding name="message" key="abandon.changes"/>
    </component>
    
    &delegate; 

###############################################################


The only drawback for me is, that Spindle doesn't seem to read the
included stuff. But I can live with that.

And: Currently this XML-feature is broken in Tap4. I have submitted
a patch that fixes it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to