You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by intelli j <in...@webmail.co.za> on 2004/08/04 12:38:37 UTC

Simple Component

Hi,

I'm new to Tapestry (hopefully this post is not too
retarded...)

I'm trying to create a simple re-useable component with a
single parameter - for example rendering the necessary
fields for an Address. For example, our medically oriented
system has a ContactDetails object with two private address
objects, with the required setter/getters. No .java exists
for the component. Depending on my choice of param
direction I get differing results - I think the most
appropriate type for the direction is form - but this gives
ClassCastExceptions during rewind. The initial rendering of
the page works perfectly - it is only on submit that things
seem to go wrong. Changing the direction to auto doesn't
help much...

Parent Page Specification Extract:
   <component id="edit_addressPhysical"
type="AddressComponent">
        <binding name="address_data_source"
expression="medicalPersonnel.contactDetails.addressPhysical"/>
     </component>
     <component id="edit_addressPostal"
type="AddressComponent">
        <binding name="address_data_source"
expression="medicalPersonnel.contactDetails.addressPostal"/>
    </component>

AddressComponent.jwc:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE component-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification
3.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

<component-specification
    allow-informal-parameters="no">
    <!--allow-body="no"   -->
    <parameter name="address_data_source"
        direction="form"
        required="yes"
        type="smart.model.general.Address">
    </parameter>

    <component id="edit_Address1" type="TextField">
        <binding name="value"
expression="address_data_source.address1"/>
    </component>

    <component id="edit_Address2" type="TextField">
        <binding name="value"
expression="address_data_source.address2"/>
    </component>
_____________________________________________________________________
For super low premiums ,click here http://www.dialdirect.co.za/quote

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Simple Component

Posted by Jamie Orchard-Hays <ja...@dang.com>.
A couple of questions:

How are you using this? It's not clear from your email what you are 
trying to accomplish by creating this component.

What is the error/stack trace you got?

If you just want to use the component for displaying, then you want 
direction "in".


Jamie
On Aug 4, 2004, at 6:38 AM, intelli j wrote:

> Hi,
>
> I'm new to Tapestry (hopefully this post is not too
> retarded...)
>
> I'm trying to create a simple re-useable component with a
> single parameter - for example rendering the necessary
> fields for an Address. For example, our medically oriented
> system has a ContactDetails object with two private address
> objects, with the required setter/getters. No .java exists
> for the component. Depending on my choice of param
> direction I get differing results - I think the most
> appropriate type for the direction is form - but this gives
> ClassCastExceptions during rewind. The initial rendering of
> the page works perfectly - it is only on submit that things
> seem to go wrong. Changing the direction to auto doesn't
> help much...
>
> Parent Page Specification Extract:
>    <component id="edit_addressPhysical"
> type="AddressComponent">
>         <binding name="address_data_source"
> expression="medicalPersonnel.contactDetails.addressPhysical"/>
>      </component>
>      <component id="edit_addressPostal"
> type="AddressComponent">
>         <binding name="address_data_source"
> expression="medicalPersonnel.contactDetails.addressPostal"/>
>     </component>
>
> AddressComponent.jwc:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE component-specification PUBLIC
>   "-//Apache Software Foundation//Tapestry Specification
> 3.0//EN"
>   "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
>
> <component-specification
>     allow-informal-parameters="no">
>     <!--allow-body="no"   -->
>     <parameter name="address_data_source"
>         direction="form"
>         required="yes"
>         type="smart.model.general.Address">
>     </parameter>
>
>     <component id="edit_Address1" type="TextField">
>         <binding name="value"
> expression="address_data_source.address1"/>
>     </component>
>
>     <component id="edit_Address2" type="TextField">
>         <binding name="value"
> expression="address_data_source.address2"/>
>     </component>
> _____________________________________________________________________
> For super low premiums ,click here http://www.dialdirect.co.za/quote
>
> ---------------------------------------------------------------------
> 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