You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "hv @ Fashion Content" <in...@fashioncontent.com> on 2005/12/01 14:15:37 UTC

Re: Load domain object before setting parameters

Have you tried overloading page.activate() to load your domain object?

I find it a bit hard to suggest a solution as I don't know how you identity 
your domain object.
How do you know which one to load? Also is the form in a component or a 
page.

In general I think a good solution is using a proxy domain object that loads 
the actual one and passes on operations on it.

I identify the user domain object in a ServletFilter, so once Tapestry 
handles the request there will always be a domain object.

Henrik

"Reggie Chan" <re...@reggiechan.com> skrev i en meddelelse 
news:438DD22D.2090501@reggiechan.com...
> I'm using tapestry 4 and hibernate in our application, we are using ognl 
> to update the domain object's properties like user.login, user.email etc.. 
> However, we are unable to load the user object before these properties 
> being set during the rewind stage.
>
> After looking at mailing list archive and forum, I've found the following 
> approaches to deal with the problems
>
> 1. Adding a hidden field as the first input in the form and use 
> IActionListener to load the domain object from hibernate. This relies on 
> the fact that I.E. passes first fields up in the order of they are shown 
> in the form. However, does it have to happen for other browsers and for 
> I.E. 7 for future extensibility? I've found that firefox use the order 
> that the input nodes created instead of the order that they are shown in 
> the html. Although in this case, most likely, the hidden key input would 
> still be the first input to be passed to the server, this does show the 
> possibility that different browser could have different behavior in that 
> aspect.
>
> 2. Using DataSqueezer to load the domain object. I haven't tried this yet, 
> but does it always have to ensure that the hidden key field is passed as 
> the first input?
>
> 3. Using a "fake" domain object and then copy all properties over to the 
> real domain object before save.
>
> 4. Temporarily save the properties to the page object then copy all to the 
> real domain object before save.
>
> 5. Use http session to persist the domain object, but the user will not be 
> able to open muiltiple tags in firefox or clone a new browser instance by 
> "Ctrl-n" in I.E. as they will share the same session.
>
> 6. Use http session as 5., but add a sychronization token in all form to 
> avoid mis-updating.
>
> I think this problem is pretty much a common problem to many users, could 
> someone share how they deal with this issue and give us some advice on the 
> issue. We're afraid that we've missed out some better ways to deal with 
> the issue in tapestry, as we are new to tapestry e.g. we can tell tapestry 
> to set certain properties first and the others after instead of relying on 
> browser's behavior, etc.. Our development team has struggled in this issue 
> pretty badly.
>
> Thanks in advance!
>
> ---------------------------------------------------------------------
> 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: Load domain object before setting parameters

Posted by Reggie Chan <re...@reggiechan.com>.
Thanks for the advice!

My domain objects are identified by id and as i do not want to use 
session for that page, id is not available at the activate() time.

Currently i'm using the datasqueezer to load the object and set a hidden 
field as the first field in the form so that the domain object is 
available when tapestry set other field's value onto it.

hv @ Fashion Content wrote:

>Have you tried overloading page.activate() to load your domain object?
>
>I find it a bit hard to suggest a solution as I don't know how you identity 
>your domain object.
>How do you know which one to load? Also is the form in a component or a 
>page.
>
>In general I think a good solution is using a proxy domain object that loads 
>the actual one and passes on operations on it.
>
>I identify the user domain object in a ServletFilter, so once Tapestry 
>handles the request there will always be a domain object.
>
>Henrik
>
>"Reggie Chan" <re...@reggiechan.com> skrev i en meddelelse 
>news:438DD22D.2090501@reggiechan.com...
>  
>
>>I'm using tapestry 4 and hibernate in our application, we are using ognl 
>>to update the domain object's properties like user.login, user.email etc.. 
>>However, we are unable to load the user object before these properties 
>>being set during the rewind stage.
>>
>>After looking at mailing list archive and forum, I've found the following 
>>approaches to deal with the problems
>>
>>1. Adding a hidden field as the first input in the form and use 
>>IActionListener to load the domain object from hibernate. This relies on 
>>the fact that I.E. passes first fields up in the order of they are shown 
>>in the form. However, does it have to happen for other browsers and for 
>>I.E. 7 for future extensibility? I've found that firefox use the order 
>>that the input nodes created instead of the order that they are shown in 
>>the html. Although in this case, most likely, the hidden key input would 
>>still be the first input to be passed to the server, this does show the 
>>possibility that different browser could have different behavior in that 
>>aspect.
>>
>>2. Using DataSqueezer to load the domain object. I haven't tried this yet, 
>>but does it always have to ensure that the hidden key field is passed as 
>>the first input?
>>
>>3. Using a "fake" domain object and then copy all properties over to the 
>>real domain object before save.
>>
>>4. Temporarily save the properties to the page object then copy all to the 
>>real domain object before save.
>>
>>5. Use http session to persist the domain object, but the user will not be 
>>able to open muiltiple tags in firefox or clone a new browser instance by 
>>"Ctrl-n" in I.E. as they will share the same session.
>>
>>6. Use http session as 5., but add a sychronization token in all form to 
>>avoid mis-updating.
>>
>>I think this problem is pretty much a common problem to many users, could 
>>someone share how they deal with this issue and give us some advice on the 
>>issue. We're afraid that we've missed out some better ways to deal with 
>>the issue in tapestry, as we are new to tapestry e.g. we can tell tapestry 
>>to set certain properties first and the others after instead of relying on 
>>browser's behavior, etc.. Our development team has struggled in this issue 
>>pretty badly.
>>
>>Thanks in advance!
>>
>>---------------------------------------------------------------------
>>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