Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Load domain object before setting parameters

    5 answers - 2524 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    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 development team has
    struggled in this issue pretty badly.
    Thanks in advance!
    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
  • No.1 | | 3388 bytes | |

    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
    development team has struggled in this issue pretty badly.

    Thanks in advance!

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
  • No.2 | | 3540 bytes | |

    **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
    development team has struggled in this issue pretty badly.

    Thanks in advance!

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
  • No.3 | | 3790 bytes | |

    The following

    11/30/05, Reggie Chan <reggie (AT) tnc (DOT) hkwrote:
    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
    development team has struggled in this issue pretty badly.

    Thanks in advance!

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
    >
    >
    >


    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
    --
  • No.4 | | 3382 bytes | |

    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" <reggie (AT) reggiechan (DOT) comskrev i en meddelelse
    news:438DD22D.2090501 (AT) reggiechan (DOT) 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 development team has struggled in this issue
    pretty badly.

    Thanks in advance!

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org

    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
  • No.5 | | 4660 bytes | |

    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" <reggie (AT) reggiechan (DOT) comskrev i en meddelelse
    >news:438DD22D.2090501 (AT) reggiechan (DOT) 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 development team has struggled in this issue
    >>pretty badly.
    >>
    >>Thanks in advance!
    >>
    >>
    >>To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    >>For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
    >>
    >>

    >
    >>

    >
    >
    >
    >
    >
    >To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    >For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org
    >


    To unsubscribe, e-mail: tapestry-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tapestry-user-help (AT) jakarta (DOT) apache.org

Re: Load domain object before setting parameters


max 4000 letters.
Your nickname that display:
In order to stop the spam: 5 + 4 =
QUESTION ON "Java"

EMSDN.COM