Hi Vikram,
When you set Pages to stateful they are constructed once and reused
between requests. Thus their constructor is only called once, but they
still go through the same lifecycle of onInit, onProcess, onGet etc.
What is most likely happening is that you add the logoutLink in the
onInit phase meaning on the second request to a stateful page, the
link is added for a second time and Click complains.
If you want to use a stateful page its best to add controls in the
Page constructor not the onInit phase.
See section 8.1:
http://click.sourceforge.net/docs/pages.html#page-stateful
Does that help?
kind regards
bob
Vikram Natarajan wrote:
I have a Page subclassing a BorderTemplate Page which adds a control
("Login/Logout" - a PageLink named "logoutLink").
When I make the subclassed Page stateful, I get an Exception that the
"model" already contains value named "logoutLink" when I submit the form
on this page.
When I set stateful to false, I don't get the exception.
What am I doing wrong here? Thanks for your help in advance.