Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1062807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:41:07+00:00 2026-05-16T18:41:07+00:00

If I get a bean and a dialog, and they are coupled with bidirectional

  • 0

If I get a bean and a dialog, and they are coupled with bidirectional data-binding, what is the best way to roll back to the original bean when user canceled the editing.

EDIT 1

If user opened up the dialog in edit mode, he then did some modification and pressed “OK”, then this dialog closed and the underlying bean got updated. When I said “canceled the editing”, I mean the user opened up the dialog and did some modification but pressed “cancel” button. In this case, the underlying bean should keep untouched, but due to data-binding, it become dirty, I want the original bean back.

I can just clone a bean when the dialog opens, if user presses “OK” the cloned bean will be copied back to original bean; if user presses “cancel” the cloned bean will be abandoned.
I don’t know if this is a good approach.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:41:08+00:00Added an answer on May 16, 2026 at 6:41 pm

    I have always used the clone approach quite successfully. The clone approach comes in two varieties: bind to clone and bind to original.

    Bind to clone will make it so any other binding to the same field on the screen will not update while your dialog box is up. When OK is pressed you copy the clone to the original object, on cancel you simply throw the clone away.

    Bind to original allows screen updates to others components bound to the same field. When OK is pressed you throw the clone away. When cancel is pressed you copy the clone to the original.

    I favor the bind to clone approach since I think it is confusing to see other on screen components updating while a dialog box is up. I think it creates confusion as to whether cancel will rollback changes that are appearing outside the dialog box.

    The alternative is to use a flushable binding strategy where a binding can be set up in such a way that it will not update the object until some kind of flush() method has been called. If your databinding framework does not support this then it can be a lot of work to tack this on later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get the spring application context from a non bean object. In
When I call getBean(name) on a BeanFactory , I get back an instance of
We get a large amount of data from our clients in pdf files in
I get a URL from a user. I need to know: a) is the
I get this error: Can't locate Foo.pm in @INC Is there an easier way
I would like to get inner bean by it's name. Is it possible with
I am not able to get spring bean in the service layer(ServiceContext.getBean(beanName)). I am
When I worked in Spring, I could get a bean a bean listed in
I have method to get list of bean properities like below. How to check
Im sure why, but my viewscoped-bean doesnt get persisted when redisplaying the same page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.