You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Courcy <mi...@gmail.com> on 2007/11/17 00:16:32 UTC

How to make a basic crud : Feedback wanted

http://wiki.apache.org/tapestry/Tapestry5How_to_make_a_basic_crud

-- 
Michael Courcy
http://courcy.blogspot.com


Re: How to make a basic crud : Feedback wanted

Posted by Michael Courcy <mi...@gmail.com>.
Vjeran Marcinko a écrit :
> Hi.
>
> Although your example is very simple in code as such, it suffers from 
> some drawbacks, mainly because you don't have activation context for 
> Save page.
>
> 1. Your create and edit actions on Start page use ActionLinks which 
> make 2 HTTP requests (action + render Save page), whereas PageLinks 
> with "myBeanId" context value would execute just one HTTP request 
> which will just render Save page, and that is all you actually need
Did  you mean that instead of 

<t:actionlink t:id="edit" context="myBean.id">

You'd rather see 

<t:pageLink page="Save" context="myBean.id"> 



> 2. Its always good practice to pass only necessary activation context 
> values (in this case myBeanId), and let page itself be responsible to 
> reconstructing all that is necessary, meaning, it is not good to 
> instantiate new MyBean or fetch it from database outside of Save page 
> as in your case, but to do it inside it, in onPrepare event method. 
> This way if you have some additions to save page which maybe lead to 
> another page and get back to it, all you need to do when getting back 
> to Save page is to make certain this entity ID is present there, and 
> page will know how to reconstruct itself.
You are right
>
> 3. If you keep only "myBeanId" inside Save as Session persistent 
> value, your Session has much less overhead in cluster recplication 
> then when holding whole instances. Though I guess this is just small 
> gain, often dismissable.
ok
>
> Of course, all the written above depends on situation and your needs.
>
> Regards,
> Vjeran
Thanks a lot, I going to rework this.
>
> ----- Original Message ----- From: "Michael Courcy" 
> <mi...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Saturday, November 17, 2007 12:16 AM
> Subject: How to make a basic crud : Feedback wanted
>
>
>> http://wiki.apache.org/tapestry/Tapestry5How_to_make_a_basic_crud
>>
>> -- 
>> Michael Courcy
>> http://courcy.blogspot.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Michael Courcy
http://courcy.blogspot.com


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


Re: How to make a basic crud : Feedback wanted

Posted by Vjeran Marcinko <vj...@email.t-com.hr>.
Hi.

Although your example is very simple in code as such, it suffers from some 
drawbacks, mainly because you don't have activation context for Save page.

1. Your create and edit actions on Start page use ActionLinks which make 2 
HTTP requests (action + render Save page), whereas PageLinks with "myBeanId" 
context value would execute just one HTTP request which will just render 
Save page, and that is all you actually need
2. Its always good practice to pass only necessary activation context values 
(in this case myBeanId), and let page itself be responsible to 
reconstructing all that is necessary, meaning, it is not good to instantiate 
new MyBean or fetch it from database outside of Save page as in your case, 
but to do it inside it, in onPrepare event method. This way if you have some 
additions to save page which maybe lead to another page and get back to it, 
all you need to do when getting back to Save page is to make certain this 
entity ID is present there, and page will know how to reconstruct itself.
3. If you keep only "myBeanId" inside Save as Session persistent value, your 
Session has much less overhead in cluster recplication then when holding 
whole instances. Though I guess this is just small gain, often dismissable.

Of course, all the written above depends on situation and your needs.

Regards,
Vjeran

----- Original Message ----- 
From: "Michael Courcy" <mi...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Saturday, November 17, 2007 12:16 AM
Subject: How to make a basic crud : Feedback wanted


> http://wiki.apache.org/tapestry/Tapestry5How_to_make_a_basic_crud
>
> -- 
> Michael Courcy
> http://courcy.blogspot.com


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