Hi!

What you describe should only happen in certain cases:

- when you link to the page using a stored reference e.g.

in ctor:
myTargetPage = new MyTargetPage()

in click handler:
setResponsePage(myTargetPage);

This results in a single, shared page instance. The page will keep track of state, and thus the state is shared.

- when you create a new page instance (bookmarkable or not doesn't matter) for every click, but it's data comes from a static source (page-static, session-based or other)

This means that your freshly created page instance loads data from a source which "caches" its data. E.g. your EntityFactory does not always return a fresh instance.

So the first question is: how do you link to your "Add a record" page?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 19-2-2013 17:12, schreef Michael Chandler:
Good morning all!  I thought I had a good handle on an issue I was having, but 
it appears as though that problem is persisting.  When I present a form to the 
user to collect information that saves on a domain object, the form does not 
reset after the form has been submitted.  At first, I thought it was related to 
how I link to pages, then I became convinced it was my use of a 
LoadableDetachableModel.  Now, after refactoring the code several times, I'm 
convinced that I have over-looked something simple but I cannot figure out what 
it is.

To summarize, I have a form that binds to an object as follows:

CompoundPropertyModel<Job> jobModel = new CompoundPropertyModel<Job>((Job) 
EntityFactory.getInstance().getBean("job"));
jobForm.setModel(jobModel);

When the form fields are all completed and the form is submitted, the form's 
onSubmit() successfully handles the submission and my implementation persists 
the data to my domain object (Job) and the data is confirmed in the database.  
The last line conducts a redirect to the main screen with a setResponsePage() 
call.

When I click the link to add a new record to the database using the same form, 
the form fields are populated with all of the same data I just entered, 
suggesting to me that the previous domain object is still bound to that page 
instead of refreshing and binding a clean, new instance of the Job class.

Can anyone offer any tips or suggestions on what I am doing wrong?

Best,

Mike



Reply via email to