You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Reggie Chan <re...@reggiechan.com> on 2005/11/30 17:24:13 UTC

Load domain object before setting parameters

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


Re: Load domain object before setting parameters

Posted by Geoff Longman <gl...@gmail.com>.
The following...

On 11/30/05, Reggie Chan <re...@tnc.hk> wrote:
> After further reading the source code of tapestry, I found that it seems
> my previous guess of relying browser's input ordering in approach 1 and
> 2 were wrong that tapestry actually uses the order in which the
> components are found in the page/component template's body. And as
> approach 1 and 2 set the Hidden key field as the first input in the
> form's body, it becomes the first inner component in the form and thus
> the first component to render/rewind, this ensure that the key is the
> first formComponent to be updated in the form.

..is correct, fields are processed as rendered (rewound) so if your
hidden is the first form component rendered, it will be rewound before
any others. Note that conditionals can make this tricky (unless of
course you use If components instead of Conditionals).

>
> Could someone tell if the above understanding of the source code is
> correct? Thanks!
>
> Reggie Chan wrote:
> > 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
>
>


--
The Spindle guy.           http://spindle.sf.net
Get help with Spindle:   
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:    
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates:            http://spindle.sf.net/updates

---------------------------------------------------------------------
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...@tnc.hk>.
After further reading the source code of tapestry, I found that it seems 
my previous guess of relying browser's input ordering in approach 1 and 
2 were wrong that tapestry actually uses the order in which the 
components are found in the page/component template's body. And as 
approach 1 and 2 set the Hidden key field as the first input in the 
form's body, it becomes the first inner component in the form and thus 
the first component to render/rewind, this ensure that the key is the 
first formComponent to be updated in the form.

Could someone tell if the above understanding of the source code is 
correct? Thanks!

Reggie Chan wrote:
> 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>.
**Sorry if the message has been sent twice, as I wrongly sent the email 
with another account and that apache said it was classified as spam**

After further reading the source code of tapestry, I found that it seems 
my previous guess of relying browser's input ordering in approach 1 and 
2 were wrong that tapestry actually uses the order in which the 
components are found in the page/component template's body. And as 
approach 1 and 2 set the Hidden key field as the first input in the 
form's body, it becomes the first inner component in the form and thus 
the first component to render/rewind, this ensure that the key is the 
first formComponent to be updated in the form.

Could someone tell if the above understanding of the source code is 
correct? Thanks!

Reggie Chan wrote:
> 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


Re: Load domain object before setting parameters

Posted by "hv @ Fashion Content" <in...@fashioncontent.com>.
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