You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Reinier Mostert <re...@clabo.co.za> on 2003/04/28 17:17:39 UTC

DefaultValuePersister for Cayenne & Tapestry

Hi all,

in February there was a discussion on the Cayenne mailing list
concerning hollow objects that occurred because Tapestry 2.4 changed the
way in which variables were serialized, in particular the way the
DataContext was serialized.  

Howard suggested a solution that consists of subclassing
DefaultValuePersister to create a CayenneValuePersister that makes
immutable copies, and registering this as the value copier for Cayenne
DataObject.

I'm trying to do this with Tapestry 2.4 alpha 5, but I can't find
DefaultValuePersister anywhere.  I've searched the sources for it, but
the class seems to be missing.  I presume that it has been removed in
the name of progress ;-) and that it is also missing in Tapestry 2.4
beta 1.

Does any one have a different solution for this problem?

Thanx
reinier

PS - I will supply details of the messages that flew around if needed,
but I assume that the people who can help with this, will know what I'm
talking about.

-- 
Reinier Mostert <re...@clabo.co.za>


Re: Question on cleaning up resources...

Posted by Jukka Rahkonen <ju...@itmoon.fi>.
Hi statish,

I strongly suggest no to combine two different pooling mechanisms
togeather. That would be dangerous design. jdbc connection pool and
component pool should stay separated.

detach() is an essential method for component pool handling. Make
sure that you call super.detach() allways and try not to prevent
Tapestry from calling detach().

The use of jdbc connection should be located on your business logic
layer or at least in visit or engine object. All necessary data should
be collected inside one method in visit or engine by using proper
try - catch - finally structure. Then pass the necessary values or
array of valueobjects to your component.

BR,
  Jukka Rahkonen   jukka.rahkonen@itmoon.fi



Sathish Senathi wrote:

>Hi  i have a page and a custom control , the custom control takes the
>parameter named "connection" which is of type java.sql.Connection.
>
>The custom control has a DirecLink component which uses the connection
>object.
>
>My problem is as follows
>
>I have overridden the Page:Detach function the page to close the connection
>and set it to null.  my problem is once the page is rendered the Detach is
>called , but when i click the DirectLink the component has a invalid
>connection object. How do make tapestry not to call Detach after page
>rendering.
>
>Also i noticed that after the directLink executed the Detach is called
>again.
>
>I am still using 2.3 rc1
>Thanks
>sathish
>
>----- Original Message -----
>From: "Jukka Rahkonen" <ju...@itmoon.fi>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Wednesday, April 30, 2003 4:14 PM
>Subject: Re: Question on how to bind attribute for an HTML element
>
>
>  
>
>>Hi,
>>
>>You should use following component binding on your
>>.page or .jwc:
>>
>><component id="myColor" type="Any">
>>  <static-binding name="element">td</static-binding>
>>  <binding name="bgcolor" expression="myColor"/>
>></component>
>>
>>There is an example in Tutorial and in Developers Guide.
>>See Component Reference for type "Any" also.
>>
>>BR,
>>   Jukka Rahkonen
>>   jukka.rahkonen@itmoon.fi
>>
>>
>>Sathish Senathi wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>I have the following template
>>>
>>><span jwcid="dbRows">
>>>
>>><tr >
>>>
>>><span jwcid="dbCols">
>>>
>>><td>
>>>
>>><span jwcid="dbItem">Item</span>
>>>
>>></td>
>>>
>>></span>
>>>
>>></tr>
>>>
>>></span>
>>>
>>>
>>>
>>>I want the <tr>  to have the bgcolor attribute and value should be binded
>>>      
>>>
>to
>  
>
>>>an expession
>>>
>>>like the following:
>>>
>>><td  jwcid="myColor">
>>>
>>>and myColor retunrs "bgcolor=#xxxxx". Is this right way to do it ?. I
>>>      
>>>
>dont
>  
>
>>>see examples on this. I do see an example for <BODY> element where you
>>>      
>>>
>can
>  
>
>>>change the color dynamically.
>>>
>>>Any help wil be appreciated.
>>>
>>>Thanks
>>>
>>>sathish
>>>
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>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
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>



Re: Question on cleaning up resources...

Posted by Sathish Senathi <sa...@optusnet.com.au>.
Howard,

I figured it out . Now i use ActionLink, i understood that Directlink is
executed behore any binding takes place so my Connection parameter is null.
Once i replaced the Directlink with ActionLink the problem went away.

The scenario is simple :

A custom component who input parameter is a Connection object which is
embedded in my Page and Page has a method getConnection which is binded to
the Connection Parameter of the component.

After the page is rendered all the parameters are clears or set to NULL,
When i was using directLink the method gets connection as NULL, once i
replaced it with Action Link, the Binding takes place , now the component
has the connection object and everything went thro fine.

Good way to learn the difference between DirectLink and ActionLink :-)))
-sathish

----- Original Message -----
From: "Howard M. Lewis Ship" <hl...@attbi.com>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Wednesday, April 30, 2003 9:36 PM
Subject: RE: Question on cleaning up resources...


> I'm having trouble following your issue.  Please try to break it down.
When
> talking about DirectLink, you are talking about two different requests:
the
> first request where the link is rendered and the second request where the
> link is clicked.
>
> Start by breaking down what you need to occur in each request.  Does
request
> #1 need the DB connection?  Does request #2?  Is there some data fetched
> from the DB that must propogate between the two requests?
>
> --
> Howard M. Lewis Ship
> Creator, Tapestry: Java Web Components
> http://jakarta.apache.org/tapestry
>
>
>
> > -----Original Message-----
> > From: Sathish Senathi [mailto:sathishs@optusnet.com.au]
> > Sent: Wednesday, April 30, 2003 2:56 AM
> > To: Tapestry users
> > Subject: Question on cleaning up resources...
> >
> >
> > Hi  i have a page and a custom control , the custom control
> > takes the parameter named "connection" which is of type
> > java.sql.Connection.
> >
> > The custom control has a DirecLink component which uses the
> > connection object.
> >
> > My problem is as follows
> >
> > I have overridden the Page:Detach function the page to close
> > the connection and set it to null.  my problem is once the
> > page is rendered the Detach is called , but when i click the
> > DirectLink the component has a invalid connection object. How
> > do make tapestry not to call Detach after page rendering.
> >
> > Also i noticed that after the directLink executed the Detach
> > is called again.
> >
> > I am still using 2.3 rc1
> > Thanks
> > sathish
> >
> > ----- Original Message -----
> > From: "Jukka Rahkonen" <ju...@itmoon.fi>
> > To: "Tapestry users" <ta...@jakarta.apache.org>
> > Sent: Wednesday, April 30, 2003 4:14 PM
> > Subject: Re: Question on how to bind attribute for an HTML element
> >
> >
> > > Hi,
> > >
> > > You should use following component binding on your
> > > .page or .jwc:
> > >
> > > <component id="myColor" type="Any">
> > >   <static-binding name="element">td</static-binding>
> > >   <binding name="bgcolor" expression="myColor"/>
> > > </component>
> > >
> > > There is an example in Tutorial and in Developers Guide.
> > > See Component Reference for type "Any" also.
> > >
> > > BR,
> > >    Jukka Rahkonen
> > >    jukka.rahkonen@itmoon.fi
> > >
> > >
> > > Sathish Senathi wrote:
> > >
> > > >Hi,
> > > >
> > > >I have the following template
> > > >
> > > ><span jwcid="dbRows">
> > > >
> > > ><tr >
> > > >
> > > ><span jwcid="dbCols">
> > > >
> > > ><td>
> > > >
> > > ><span jwcid="dbItem">Item</span>
> > > >
> > > ></td>
> > > >
> > > ></span>
> > > >
> > > ></tr>
> > > >
> > > ></span>
> > > >
> > > >
> > > >
> > > >I want the <tr>  to have the bgcolor attribute and value should be
> > > >binded
> > to
> > > >an expession
> > > >
> > > >like the following:
> > > >
> > > ><td  jwcid="myColor">
> > > >
> > > >and myColor retunrs "bgcolor=#xxxxx". Is this right way to
> > do it ?. I
> > dont
> > > >see examples on this. I do see an example for <BODY> element where
> > > >you
> > can
> > > >change the color dynamically.
> > > >
> > > >Any help wil be appreciated.
> > > >
> > > >Thanks
> > > >
> > > >sathish
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >---------------------------------------------------------------------
> > > >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
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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
>


RE: Question on cleaning up resources...

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
I'm having trouble following your issue.  Please try to break it down.  When
talking about DirectLink, you are talking about two different requests: the
first request where the link is rendered and the second request where the
link is clicked.

Start by breaking down what you need to occur in each request.  Does request
#1 need the DB connection?  Does request #2?  Is there some data fetched
from the DB that must propogate between the two requests?

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Sathish Senathi [mailto:sathishs@optusnet.com.au] 
> Sent: Wednesday, April 30, 2003 2:56 AM
> To: Tapestry users
> Subject: Question on cleaning up resources...
> 
> 
> Hi  i have a page and a custom control , the custom control 
> takes the parameter named "connection" which is of type 
> java.sql.Connection.
> 
> The custom control has a DirecLink component which uses the 
> connection object.
> 
> My problem is as follows
> 
> I have overridden the Page:Detach function the page to close 
> the connection and set it to null.  my problem is once the 
> page is rendered the Detach is called , but when i click the 
> DirectLink the component has a invalid connection object. How 
> do make tapestry not to call Detach after page rendering.
> 
> Also i noticed that after the directLink executed the Detach 
> is called again.
> 
> I am still using 2.3 rc1
> Thanks
> sathish
> 
> ----- Original Message -----
> From: "Jukka Rahkonen" <ju...@itmoon.fi>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, April 30, 2003 4:14 PM
> Subject: Re: Question on how to bind attribute for an HTML element
> 
> 
> > Hi,
> >
> > You should use following component binding on your
> > .page or .jwc:
> >
> > <component id="myColor" type="Any">
> >   <static-binding name="element">td</static-binding>
> >   <binding name="bgcolor" expression="myColor"/>
> > </component>
> >
> > There is an example in Tutorial and in Developers Guide.
> > See Component Reference for type "Any" also.
> >
> > BR,
> >    Jukka Rahkonen
> >    jukka.rahkonen@itmoon.fi
> >
> >
> > Sathish Senathi wrote:
> >
> > >Hi,
> > >
> > >I have the following template
> > >
> > ><span jwcid="dbRows">
> > >
> > ><tr >
> > >
> > ><span jwcid="dbCols">
> > >
> > ><td>
> > >
> > ><span jwcid="dbItem">Item</span>
> > >
> > ></td>
> > >
> > ></span>
> > >
> > ></tr>
> > >
> > ></span>
> > >
> > >
> > >
> > >I want the <tr>  to have the bgcolor attribute and value should be 
> > >binded
> to
> > >an expession
> > >
> > >like the following:
> > >
> > ><td  jwcid="myColor">
> > >
> > >and myColor retunrs "bgcolor=#xxxxx". Is this right way to 
> do it ?. I
> dont
> > >see examples on this. I do see an example for <BODY> element where 
> > >you
> can
> > >change the color dynamically.
> > >
> > >Any help wil be appreciated.
> > >
> > >Thanks
> > >
> > >sathish
> > >
> > >
> > >
> > >
> > >
> > 
> >---------------------------------------------------------------------
> > >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
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


Question on cleaning up resources...

Posted by Sathish Senathi <sa...@optusnet.com.au>.
Hi  i have a page and a custom control , the custom control takes the
parameter named "connection" which is of type java.sql.Connection.

The custom control has a DirecLink component which uses the connection
object.

My problem is as follows

I have overridden the Page:Detach function the page to close the connection
and set it to null.  my problem is once the page is rendered the Detach is
called , but when i click the DirectLink the component has a invalid
connection object. How do make tapestry not to call Detach after page
rendering.

Also i noticed that after the directLink executed the Detach is called
again.

I am still using 2.3 rc1
Thanks
sathish

----- Original Message -----
From: "Jukka Rahkonen" <ju...@itmoon.fi>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, April 30, 2003 4:14 PM
Subject: Re: Question on how to bind attribute for an HTML element


> Hi,
>
> You should use following component binding on your
> .page or .jwc:
>
> <component id="myColor" type="Any">
>   <static-binding name="element">td</static-binding>
>   <binding name="bgcolor" expression="myColor"/>
> </component>
>
> There is an example in Tutorial and in Developers Guide.
> See Component Reference for type "Any" also.
>
> BR,
>    Jukka Rahkonen
>    jukka.rahkonen@itmoon.fi
>
>
> Sathish Senathi wrote:
>
> >Hi,
> >
> >I have the following template
> >
> ><span jwcid="dbRows">
> >
> ><tr >
> >
> ><span jwcid="dbCols">
> >
> ><td>
> >
> ><span jwcid="dbItem">Item</span>
> >
> ></td>
> >
> ></span>
> >
> ></tr>
> >
> ></span>
> >
> >
> >
> >I want the <tr>  to have the bgcolor attribute and value should be binded
to
> >an expession
> >
> >like the following:
> >
> ><td  jwcid="myColor">
> >
> >and myColor retunrs "bgcolor=#xxxxx". Is this right way to do it ?. I
dont
> >see examples on this. I do see an example for <BODY> element where you
can
> >change the color dynamically.
> >
> >Any help wil be appreciated.
> >
> >Thanks
> >
> >sathish
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >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
>


Re: Question on how to bind attribute for an HTML element

Posted by Sathish Senathi <sa...@optusnet.com.au>.
Thanks that works..
-sathish

----- Original Message -----
From: "Jukka Rahkonen" <ju...@itmoon.fi>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, April 30, 2003 5:05 PM
Subject: Re: Question on how to bind attribute for an HTML element


> Hi sathish,
>
> More complete example would be:
>
> html-template:
> ------------------------------------
> <table>
>   <tr>
>     <td jwcid="myColor">Some fixed text and <span jwcid="more"/></td>
>   </tr>
> </table>
>
> ------------------------------------
>
> .page specification:
> -------------------------------------
>
> <component id="more" type="Insert">
>   <static-binding name="value">some binded content.</static-binding>
> </component>
>
> <component id="myColor" type="Any">
>   <static-binding name="element">td</static-binding>
>   <binding name="bgcolor" expression="myColor"/>
> </component>
>
> --------------------------------------
>
> BR,
>    Jukka Rahkonen   jukka.rahkonen@itmoon.fi
>
>
>
>
>
>
>
> Sathish Senathi wrote:
>
> >Hi Jukka,
> >Your suggesion will create the tag as <td bgcolor=.../>
> >But i want
> ><td bgcolor =....>sometext </td>
> >In this case how would i do it ?
> >Thanks
> >sathish
> >
> >
> >----- Original Message -----
> >From: "Jukka Rahkonen" <ju...@itmoon.fi>
> >To: "Tapestry users" <ta...@jakarta.apache.org>
> >Sent: Wednesday, April 30, 2003 4:14 PM
> >Subject: Re: Question on how to bind attribute for an HTML element
> >
> >
> >
> >
> >>Hi,
> >>
> >>You should use following component binding on your
> >>.page or .jwc:
> >>
> >><component id="myColor" type="Any">
> >>  <static-binding name="element">td</static-binding>
> >>  <binding name="bgcolor" expression="myColor"/>
> >></component>
> >>
> >>There is an example in Tutorial and in Developers Guide.
> >>See Component Reference for type "Any" also.
> >>
> >>BR,
> >>   Jukka Rahkonen
> >>   jukka.rahkonen@itmoon.fi
> >>
> >>
> >>Sathish Senathi wrote:
> >>
> >>
> >>
> >>>Hi,
> >>>
> >>>I have the following template
> >>>
> >>><span jwcid="dbRows">
> >>>
> >>><tr >
> >>>
> >>><span jwcid="dbCols">
> >>>
> >>><td>
> >>>
> >>><span jwcid="dbItem">Item</span>
> >>>
> >>></td>
> >>>
> >>></span>
> >>>
> >>></tr>
> >>>
> >>></span>
> >>>
> >>>
> >>>
> >>>I want the <tr>  to have the bgcolor attribute and value should be
binded
> >>>
> >>>
> >to
> >
> >
> >>>an expession
> >>>
> >>>like the following:
> >>>
> >>><td  jwcid="myColor">
> >>>
> >>>and myColor retunrs "bgcolor=#xxxxx". Is this right way to do it ?. I
> >>>
> >>>
> >dont
> >
> >
> >>>see examples on this. I do see an example for <BODY> element where you
> >>>
> >>>
> >can
> >
> >
> >>>change the color dynamically.
> >>>
> >>>Any help wil be appreciated.
> >>>
> >>>Thanks
> >>>
> >>>sathish
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>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
> >>
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >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
>


Re: Question on how to bind attribute for an HTML element

Posted by Jukka Rahkonen <ju...@itmoon.fi>.
Hi sathish,

More complete example would be:

html-template:
------------------------------------
<table>
  <tr>
    <td jwcid="myColor">Some fixed text and <span jwcid="more"/></td>
  </tr>
</table>

------------------------------------

.page specification:
-------------------------------------

<component id="more" type="Insert">
  <static-binding name="value">some binded content.</static-binding>
</component>

<component id="myColor" type="Any">
  <static-binding name="element">td</static-binding>
  <binding name="bgcolor" expression="myColor"/>
</component>

--------------------------------------

BR, 
   Jukka Rahkonen   jukka.rahkonen@itmoon.fi







Sathish Senathi wrote:

>Hi Jukka,
>Your suggesion will create the tag as <td bgcolor=.../>
>But i want
><td bgcolor =....>sometext </td>
>In this case how would i do it ?
>Thanks
>sathish
>
>
>----- Original Message -----
>From: "Jukka Rahkonen" <ju...@itmoon.fi>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Wednesday, April 30, 2003 4:14 PM
>Subject: Re: Question on how to bind attribute for an HTML element
>
>
>  
>
>>Hi,
>>
>>You should use following component binding on your
>>.page or .jwc:
>>
>><component id="myColor" type="Any">
>>  <static-binding name="element">td</static-binding>
>>  <binding name="bgcolor" expression="myColor"/>
>></component>
>>
>>There is an example in Tutorial and in Developers Guide.
>>See Component Reference for type "Any" also.
>>
>>BR,
>>   Jukka Rahkonen
>>   jukka.rahkonen@itmoon.fi
>>
>>
>>Sathish Senathi wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>I have the following template
>>>
>>><span jwcid="dbRows">
>>>
>>><tr >
>>>
>>><span jwcid="dbCols">
>>>
>>><td>
>>>
>>><span jwcid="dbItem">Item</span>
>>>
>>></td>
>>>
>>></span>
>>>
>>></tr>
>>>
>>></span>
>>>
>>>
>>>
>>>I want the <tr>  to have the bgcolor attribute and value should be binded
>>>      
>>>
>to
>  
>
>>>an expession
>>>
>>>like the following:
>>>
>>><td  jwcid="myColor">
>>>
>>>and myColor retunrs "bgcolor=#xxxxx". Is this right way to do it ?. I
>>>      
>>>
>dont
>  
>
>>>see examples on this. I do see an example for <BODY> element where you
>>>      
>>>
>can
>  
>
>>>change the color dynamically.
>>>
>>>Any help wil be appreciated.
>>>
>>>Thanks
>>>
>>>sathish
>>>
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>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
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>



Re: Question on how to bind attribute for an HTML element

Posted by Sathish Senathi <sa...@optusnet.com.au>.
Hi Jukka,
Your suggesion will create the tag as <td bgcolor=.../>
But i want
<td bgcolor =....>sometext </td>
In this case how would i do it ?
Thanks
sathish


----- Original Message -----
From: "Jukka Rahkonen" <ju...@itmoon.fi>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, April 30, 2003 4:14 PM
Subject: Re: Question on how to bind attribute for an HTML element


> Hi,
>
> You should use following component binding on your
> .page or .jwc:
>
> <component id="myColor" type="Any">
>   <static-binding name="element">td</static-binding>
>   <binding name="bgcolor" expression="myColor"/>
> </component>
>
> There is an example in Tutorial and in Developers Guide.
> See Component Reference for type "Any" also.
>
> BR,
>    Jukka Rahkonen
>    jukka.rahkonen@itmoon.fi
>
>
> Sathish Senathi wrote:
>
> >Hi,
> >
> >I have the following template
> >
> ><span jwcid="dbRows">
> >
> ><tr >
> >
> ><span jwcid="dbCols">
> >
> ><td>
> >
> ><span jwcid="dbItem">Item</span>
> >
> ></td>
> >
> ></span>
> >
> ></tr>
> >
> ></span>
> >
> >
> >
> >I want the <tr>  to have the bgcolor attribute and value should be binded
to
> >an expession
> >
> >like the following:
> >
> ><td  jwcid="myColor">
> >
> >and myColor retunrs "bgcolor=#xxxxx". Is this right way to do it ?. I
dont
> >see examples on this. I do see an example for <BODY> element where you
can
> >change the color dynamically.
> >
> >Any help wil be appreciated.
> >
> >Thanks
> >
> >sathish
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >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
>


Re: Question on how to bind attribute for an HTML element

Posted by Jukka Rahkonen <ju...@itmoon.fi>.
Hi,

You should use following component binding on your
.page or .jwc:

<component id="myColor" type="Any">
  <static-binding name="element">td</static-binding>
  <binding name="bgcolor" expression="myColor"/>
</component>

There is an example in Tutorial and in Developers Guide.
See Component Reference for type "Any" also.

BR,
   Jukka Rahkonen    
   jukka.rahkonen@itmoon.fi


Sathish Senathi wrote:

>Hi,
>
>I have the following template
>
><span jwcid="dbRows">
>
><tr >
>
><span jwcid="dbCols">
>
><td>
>
><span jwcid="dbItem">Item</span>
>
></td>
>
></span>
>
></tr>
>
></span>
>
>
>
>I want the <tr>  to have the bgcolor attribute and value should be binded to
>an expession
>
>like the following:
>
><td  jwcid="myColor">
>
>and myColor retunrs "bgcolor=#xxxxx". Is this right way to do it ?. I dont
>see examples on this. I do see an example for <BODY> element where you can
>change the color dynamically.
>
>Any help wil be appreciated.
>
>Thanks
>
>sathish
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>



Question on how to bind attribute for an HTML element

Posted by Sathish Senathi <sa...@optusnet.com.au>.
Hi,

I have the following template

<span jwcid="dbRows">

<tr >

<span jwcid="dbCols">

<td>

<span jwcid="dbItem">Item</span>

</td>

</span>

</tr>

</span>



I want the <tr>  to have the bgcolor attribute and value should be binded to
an expession

like the following:

<td  jwcid="myColor">

and myColor retunrs "bgcolor=#xxxxx". Is this right way to do it ?. I dont
see examples on this. I do see an example for <BODY> element where you can
change the color dynamically.

Any help wil be appreciated.

Thanks

sathish





New components - is there any mailing list..

Posted by Sathish Senathi <sa...@optusnet.com.au>.
I am wondering about any mailing list / web site where you can specify /
vote for new components. I have atleast two things in my mind

1. SQLDataGrid component - (like the one found in .NET )
2. A datacontrol which can populate other controls in the page with data or
make controls data bound (similar to VB/ .ne)

Is there anybody working on it ?. I can contribute something on this .

Thanks
sathish






RE: DefaultValuePersister for Cayenne & Tapestry

Posted by Reinier Mostert <re...@clabo.co.za>.
Ok, I'm looking for a quick sanity check on this, please.

I've got 2 pages, A and B, with a DirectLink from A to B.  In the
listener for A, I take a property derived from CayenneDataObject, and
try to set it on B, so that when B starts up, it can examine this
property, get the correct data from the database and draw the page.

The DataContext is a member of the Visit class, and I call
visit.getDataContext() to get it.

in A I have (with Store a CayenneDataObject):
//--------------------------------------------------------
public void bDataAction(IRequestCycle cycle) {
	B nextPage = (BDataPage) cycle.getPage("BDataPage");
	Object[] parameters = cycle.getServiceParameters(); 
	Store store = (Store) parameters[0]; 
	nextPage.setStore(store);
	cycle.setPage(nextPage);
}
//--------------------------------------------------------

In B I have:

//--------------------------------------------------------
public void setStore(Store value) {
	store = value;
	fireObservedChange("store", value);
	// insert HttpSession.setAttribute call here?
}

public Store getStore() {
	// insert HttpSession.getAttribute call here?
	return store;
}
//--------------------------------------------------------

So, should I make the DataContext an attribute of the HttpSession, or
the value that I'm trying to pass.  Reading your comment, it seems it
should be the value I'm passing (i.e. store).

So, I should add the HttpSession.setAttribute call where I've shown it,
as well as a corresponding getAttribute call?

Secondly, javax.servlet.http.HttpSession seems to be a interface, and I
can't call setAttribute on it.  How do I get hold of/what is the
HttpSession instance you're making the call on?

Thanx in advance
reinier

PS - sorry if these are silly questions, I'm feeling my way around here.

On Mon, 2003-04-28 at 17:26, Howard M. Lewis Ship wrote:
> The value copying stuff that Tapestry was doing was just not viable, so I
> stripped it out.  This simplifies things for Cayanne.
> 
> It's back to the following:
> 
> setFoo(FooType foo) --> fireObservedChange("foo", foo) -->
> HttpSession.setAttribute("...", foo)
> 
> So, if you make store a Cayanne object in a persistent property, you can
> expect that it will be stored as an HttpSession attribute (immediately).  If
> you change the state of the object, you can't count on the change being
> propogated to other servers within a cluster, since most app servers only do
> replication inside setAttribute().
> 
> --
> Howard M. Lewis Ship
> Creator, Tapestry: Java Web Components
> http://jakarta.apache.org/tapestry
> 
> 
> 
> > -----Original Message-----
> > From: Reinier Mostert [mailto:rendier@clabo.co.za] 
> > Sent: Monday, April 28, 2003 11:18 AM
> > To: Tapestry users
> > Subject: DefaultValuePersister for Cayenne & Tapestry
> > 
> > 
> > Hi all,
> > 
> > in February there was a discussion on the Cayenne mailing 
> > list concerning hollow objects that occurred because Tapestry 
> > 2.4 changed the way in which variables were serialized, in 
> > particular the way the DataContext was serialized.  
> > 
> > Howard suggested a solution that consists of subclassing 
> > DefaultValuePersister to create a CayenneValuePersister that 
> > makes immutable copies, and registering this as the value 
> > copier for Cayenne DataObject.
> > 
> > I'm trying to do this with Tapestry 2.4 alpha 5, but I can't 
> > find DefaultValuePersister anywhere.  I've searched the 
> > sources for it, but the class seems to be missing.  I presume 
> > that it has been removed in the name of progress ;-) and that 
> > it is also missing in Tapestry 2.4 beta 1.
> > 
> > Does any one have a different solution for this problem?
> > 
> > Thanx
> > reinier
> > 
> > PS - I will supply details of the messages that flew around 
> > if needed, but I assume that the people who can help with 
> > this, will know what I'm talking about.
> > 
> > -- 
> > Reinier Mostert <re...@clabo.co.za>
> > 
> > 
> > ---------------------------------------------------------------------
> > 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
-- 
Reinier Mostert <re...@clabo.co.za>


RE: DefaultValuePersister for Cayenne & Tapestry

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
The value copying stuff that Tapestry was doing was just not viable, so I
stripped it out.  This simplifies things for Cayanne.

It's back to the following:

setFoo(FooType foo) --> fireObservedChange("foo", foo) -->
HttpSession.setAttribute("...", foo)

So, if you make store a Cayanne object in a persistent property, you can
expect that it will be stored as an HttpSession attribute (immediately).  If
you change the state of the object, you can't count on the change being
propogated to other servers within a cluster, since most app servers only do
replication inside setAttribute().

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Reinier Mostert [mailto:rendier@clabo.co.za] 
> Sent: Monday, April 28, 2003 11:18 AM
> To: Tapestry users
> Subject: DefaultValuePersister for Cayenne & Tapestry
> 
> 
> Hi all,
> 
> in February there was a discussion on the Cayenne mailing 
> list concerning hollow objects that occurred because Tapestry 
> 2.4 changed the way in which variables were serialized, in 
> particular the way the DataContext was serialized.  
> 
> Howard suggested a solution that consists of subclassing 
> DefaultValuePersister to create a CayenneValuePersister that 
> makes immutable copies, and registering this as the value 
> copier for Cayenne DataObject.
> 
> I'm trying to do this with Tapestry 2.4 alpha 5, but I can't 
> find DefaultValuePersister anywhere.  I've searched the 
> sources for it, but the class seems to be missing.  I presume 
> that it has been removed in the name of progress ;-) and that 
> it is also missing in Tapestry 2.4 beta 1.
> 
> Does any one have a different solution for this problem?
> 
> Thanx
> reinier
> 
> PS - I will supply details of the messages that flew around 
> if needed, but I assume that the people who can help with 
> this, will know what I'm talking about.
> 
> -- 
> Reinier Mostert <re...@clabo.co.za>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>