Re: Close Browser Behavior
Hi, I have solved the problem, overriding valueUnbound in my custom session and updating the database with my @SpringBeans works when the session is expiring. My problem was that I was using data from my session in the @Repository Dao impl class like this: MyCustomSession.get() and that issued the "There is no application attached to current thread ContainerBackgroundProcessor" exception. Many thanks for the help. Best regards Daniela 2014-03-14 14:51 GMT+01:00 Daniela L : > Hi Martin, > it is definitely a problem in my code :-)) > But unfortunately I do not understand how to update the database at that > stage using > @SpringBean? Is that impossible? Do I have to do this outside Wicket using > a HttpSessionListener? > I also tryid to make my custom session implement > HttpSessionBindingListener and override valueUnbound > but that makes no difference. Is there a example for this anywhere, that > seems to be such a common use case? > Best Regards > Daniela > > > 2014-03-13 15:40 GMT+01:00 Martin Grigorov : > > Hi, >> >> Maybe it is a problem in your code ;-) >> >> In case of session expiration this method is called in a non-worker >> thread, i.e. >> * there are no thread locals exported for the Application, RequestCycle >> and Session. >> * The Session is the current instance. The Application can be found by >> using >> * {@link Application#get(String)}. There is no way to get a reference to >> a >> RequestCycle >> */ >> public void onInvalidate() >> { >> } >> >> The javadoc clearly says that when this method is called by the web >> container due to session expiration there are no thread locals. >> The thread locals are available in #onInvalidate() only if the application >> code called Session#invalidate[Now]() explicitly. >> >> Martin Grigorov >> Wicket Training and Consulting >> >> >> On Thu, Mar 13, 2014 at 4:34 PM, Daniela L wrote: >> >> > Hi Martin, >> > if found the reason why the data is not freed in onInvalidate, >> > the Spring/Hibernate update to the database issues a "There is no >> > application attached to current thread >> > ContainerBackgroundProcessor[StandardEngine[Catalina]]". Is this a >> wicket >> > or a tomcat issue? >> > Best Regards >> > Daniela >> > >> > >> > 2014-03-12 14:31 GMT+01:00 Martin Grigorov : >> > >> > > On Wed, Mar 12, 2014 at 3:20 PM, Daniela L >> wrote: >> > > >> > > > Hi Martin, >> > > > thank you very much for your quick and brilliant answer :-) >> > > > Changing to AjaxCheckBox did the trick. >> > > > It seems to be very difficult to provide a secure way to invalidate >> > user >> > > > data >> > > > cross browser compliant. I noticed that using a tablet with android >> or >> > > IOS >> > > > the >> > > > beforeunload is not triggered at all. Therefor I added a cleanup >> method >> > > to >> > > > the onInvalidate >> > > > of my custom session which should be triggered by the tomcats >> > > > session-timeout, but >> > > > it seems using mobile devices onInvalidate is not triggered? >> > > > >> > > >> > > onInvalidate() is called by the server when the client hasn't >> > touched/used >> > > its http session for session-timeout minutes. >> > > It shouldn't matter whether it is a desktop or mobile client. >> > > >> > > >> > > > Best Regards >> > > > Daniela >> > > > >> > > > >> > > > 2014-03-12 13:21 GMT+01:00 Martin Grigorov : >> > > > >> > > > > Hi, >> > > > > >> > > > > On Wed, Mar 12, 2014 at 1:15 PM, Daniela L >> > > wrote: >> > > > > >> > > > > > Hi, >> > > > > > I am using a close browser behavior to clean up user data if the >> > user >> > > > > > closes >> > > > > > the browser window. I also use a CheckBox to toggle the >> visibility >> > of >> > > > > some >> > > > > > Textfields. Unfortunately the refresh through the click of the >> > > CheckBox >> > > > > > triggers the close browser >> > > > > > behavior. How can this be avoided? >> > > > > &g
Re: Close Browser Behavior
Hi Martin, it is definitely a problem in my code :-)) But unfortunately I do not understand how to update the database at that stage using @SpringBean? Is that impossible? Do I have to do this outside Wicket using a HttpSessionListener? I also tryid to make my custom session implement HttpSessionBindingListener and override valueUnbound but that makes no difference. Is there a example for this anywhere, that seems to be such a common use case? Best Regards Daniela 2014-03-13 15:40 GMT+01:00 Martin Grigorov : > Hi, > > Maybe it is a problem in your code ;-) > > In case of session expiration this method is called in a non-worker > thread, i.e. > * there are no thread locals exported for the Application, RequestCycle > and Session. > * The Session is the current instance. The Application can be found by > using > * {@link Application#get(String)}. There is no way to get a reference to a > RequestCycle > */ > public void onInvalidate() > { > } > > The javadoc clearly says that when this method is called by the web > container due to session expiration there are no thread locals. > The thread locals are available in #onInvalidate() only if the application > code called Session#invalidate[Now]() explicitly. > > Martin Grigorov > Wicket Training and Consulting > > > On Thu, Mar 13, 2014 at 4:34 PM, Daniela L wrote: > > > Hi Martin, > > if found the reason why the data is not freed in onInvalidate, > > the Spring/Hibernate update to the database issues a "There is no > > application attached to current thread > > ContainerBackgroundProcessor[StandardEngine[Catalina]]". Is this a wicket > > or a tomcat issue? > > Best Regards > > Daniela > > > > > > 2014-03-12 14:31 GMT+01:00 Martin Grigorov : > > > > > On Wed, Mar 12, 2014 at 3:20 PM, Daniela L > wrote: > > > > > > > Hi Martin, > > > > thank you very much for your quick and brilliant answer :-) > > > > Changing to AjaxCheckBox did the trick. > > > > It seems to be very difficult to provide a secure way to invalidate > > user > > > > data > > > > cross browser compliant. I noticed that using a tablet with android > or > > > IOS > > > > the > > > > beforeunload is not triggered at all. Therefor I added a cleanup > method > > > to > > > > the onInvalidate > > > > of my custom session which should be triggered by the tomcats > > > > session-timeout, but > > > > it seems using mobile devices onInvalidate is not triggered? > > > > > > > > > > onInvalidate() is called by the server when the client hasn't > > touched/used > > > its http session for session-timeout minutes. > > > It shouldn't matter whether it is a desktop or mobile client. > > > > > > > > > > Best Regards > > > > Daniela > > > > > > > > > > > > 2014-03-12 13:21 GMT+01:00 Martin Grigorov : > > > > > > > > > Hi, > > > > > > > > > > On Wed, Mar 12, 2014 at 1:15 PM, Daniela L > > > wrote: > > > > > > > > > > > Hi, > > > > > > I am using a close browser behavior to clean up user data if the > > user > > > > > > closes > > > > > > the browser window. I also use a CheckBox to toggle the > visibility > > of > > > > > some > > > > > > Textfields. Unfortunately the refresh through the click of the > > > CheckBox > > > > > > triggers the close browser > > > > > > behavior. How can this be avoided? > > > > > > Here is what I did (with wicket 6.12.0): > > > > > > > > > > > > > > > > > > customerFirstName = new > > > > RequiredTextField("customer.firstName"); > > > > > > customerFirstName.setOutputMarkupPlaceholderTag(true); > > > > > > closeBrowserBehavior = new AbstractDefaultAjaxBehavior() { > > > > > >@Override > > > > > > protected void respond(AjaxRequestTarget target) { > > > > > > > > > > > > AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent(); > > > > > > } > > > > > > > > > > > > @Override > > > > > > public void renderHead(Component component, > > > IHeaderResponse > > > > > >
Re: Close Browser Behavior
Hi, Maybe it is a problem in your code ;-) In case of session expiration this method is called in a non-worker thread, i.e. * there are no thread locals exported for the Application, RequestCycle and Session. * The Session is the current instance. The Application can be found by using * {@link Application#get(String)}. There is no way to get a reference to a RequestCycle */ public void onInvalidate() { } The javadoc clearly says that when this method is called by the web container due to session expiration there are no thread locals. The thread locals are available in #onInvalidate() only if the application code called Session#invalidate[Now]() explicitly. Martin Grigorov Wicket Training and Consulting On Thu, Mar 13, 2014 at 4:34 PM, Daniela L wrote: > Hi Martin, > if found the reason why the data is not freed in onInvalidate, > the Spring/Hibernate update to the database issues a "There is no > application attached to current thread > ContainerBackgroundProcessor[StandardEngine[Catalina]]". Is this a wicket > or a tomcat issue? > Best Regards > Daniela > > > 2014-03-12 14:31 GMT+01:00 Martin Grigorov : > > > On Wed, Mar 12, 2014 at 3:20 PM, Daniela L wrote: > > > > > Hi Martin, > > > thank you very much for your quick and brilliant answer :-) > > > Changing to AjaxCheckBox did the trick. > > > It seems to be very difficult to provide a secure way to invalidate > user > > > data > > > cross browser compliant. I noticed that using a tablet with android or > > IOS > > > the > > > beforeunload is not triggered at all. Therefor I added a cleanup method > > to > > > the onInvalidate > > > of my custom session which should be triggered by the tomcats > > > session-timeout, but > > > it seems using mobile devices onInvalidate is not triggered? > > > > > > > onInvalidate() is called by the server when the client hasn't > touched/used > > its http session for session-timeout minutes. > > It shouldn't matter whether it is a desktop or mobile client. > > > > > > > Best Regards > > > Daniela > > > > > > > > > 2014-03-12 13:21 GMT+01:00 Martin Grigorov : > > > > > > > Hi, > > > > > > > > On Wed, Mar 12, 2014 at 1:15 PM, Daniela L > > wrote: > > > > > > > > > Hi, > > > > > I am using a close browser behavior to clean up user data if the > user > > > > > closes > > > > > the browser window. I also use a CheckBox to toggle the visibility > of > > > > some > > > > > Textfields. Unfortunately the refresh through the click of the > > CheckBox > > > > > triggers the close browser > > > > > behavior. How can this be avoided? > > > > > Here is what I did (with wicket 6.12.0): > > > > > > > > > > > > > > > customerFirstName = new > > > RequiredTextField("customer.firstName"); > > > > > customerFirstName.setOutputMarkupPlaceholderTag(true); > > > > > closeBrowserBehavior = new AbstractDefaultAjaxBehavior() { > > > > >@Override > > > > > protected void respond(AjaxRequestTarget target) { > > > > > > > > > > AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent(); > > > > > } > > > > > > > > > > @Override > > > > > public void renderHead(Component component, > > IHeaderResponse > > > > > response) { > > > > > super.renderHead(component, response); > > > > > response.render(new > > > > > > OnDomReadyHeaderItem("window.onbeforeunload = > > > > > function (e) {" > > > > > + "if (!window.dontAsk) {" > > > > > + "Wicket.Ajax.get({u: > > > > > '"+getCallbackUrl()+"', async: false});" > > > > > + "var message = 'my message.'," > > > > > + "e = e || window.event;" + "if > (e) > > {" > > > > > + "e.returnValue = message;" + > "}}" + > > > > > "return message;" > > > > >
Re: Close Browser Behavior
Hi Martin, if found the reason why the data is not freed in onInvalidate, the Spring/Hibernate update to the database issues a "There is no application attached to current thread ContainerBackgroundProcessor[StandardEngine[Catalina]]". Is this a wicket or a tomcat issue? Best Regards Daniela 2014-03-12 14:31 GMT+01:00 Martin Grigorov : > On Wed, Mar 12, 2014 at 3:20 PM, Daniela L wrote: > > > Hi Martin, > > thank you very much for your quick and brilliant answer :-) > > Changing to AjaxCheckBox did the trick. > > It seems to be very difficult to provide a secure way to invalidate user > > data > > cross browser compliant. I noticed that using a tablet with android or > IOS > > the > > beforeunload is not triggered at all. Therefor I added a cleanup method > to > > the onInvalidate > > of my custom session which should be triggered by the tomcats > > session-timeout, but > > it seems using mobile devices onInvalidate is not triggered? > > > > onInvalidate() is called by the server when the client hasn't touched/used > its http session for session-timeout minutes. > It shouldn't matter whether it is a desktop or mobile client. > > > > Best Regards > > Daniela > > > > > > 2014-03-12 13:21 GMT+01:00 Martin Grigorov : > > > > > Hi, > > > > > > On Wed, Mar 12, 2014 at 1:15 PM, Daniela L > wrote: > > > > > > > Hi, > > > > I am using a close browser behavior to clean up user data if the user > > > > closes > > > > the browser window. I also use a CheckBox to toggle the visibility of > > > some > > > > Textfields. Unfortunately the refresh through the click of the > CheckBox > > > > triggers the close browser > > > > behavior. How can this be avoided? > > > > Here is what I did (with wicket 6.12.0): > > > > > > > > > > > > customerFirstName = new > > RequiredTextField("customer.firstName"); > > > > customerFirstName.setOutputMarkupPlaceholderTag(true); > > > > closeBrowserBehavior = new AbstractDefaultAjaxBehavior() { > > > >@Override > > > > protected void respond(AjaxRequestTarget target) { > > > > > > > > AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent(); > > > > } > > > > > > > > @Override > > > > public void renderHead(Component component, > IHeaderResponse > > > > response) { > > > > super.renderHead(component, response); > > > > response.render(new > > > > OnDomReadyHeaderItem("window.onbeforeunload = > > > > function (e) {" > > > > + "if (!window.dontAsk) {" > > > > + "Wicket.Ajax.get({u: > > > > '"+getCallbackUrl()+"', async: false});" > > > > + "var message = 'my message.'," > > > > + "e = e || window.event;" + "if (e) > {" > > > > + "e.returnValue = message;" + "}}" + > > > > "return message;" > > > > + > > > > "};")); > > > > } > > > > }; > > > > customerFirstName.add(closeBrowserBehavior); > > > > form.add(customerFirstName); > > > > > > > > createAccountCB = new CheckBox("createAccountCB", new > > > > Model(createAccount)){ > > > > @Override > > > > protected void onSelectionChanged(Boolean newSelection) { > > > > super.onSelectionChanged(newSelection); > > > > createAccount = !createAccount; > > > > } > > > > > > > > @Override > > > > protected boolean wantOnSelectionChangedNotifications() > > > > { > > > > return true; > > > > > > > > > > This uses non-Ajax way to submit the new selection. > > > As you noted this leads to 'beforeunload' event being fired. > > > > > > You will have to use AjaxCheckBox or AjaxFormComponentUpdatingBehavior > to > > > avoid the page reload. > > > > > > > > > > } > > > > }; > > > > form.add(createAccountCB); > > > > > > > > emailRepeat = new TextField("emailRepeat", new > > > > PropertyModel(appointCalendar, customer.eMailAdress")){ > > > > @Override > > > > protected void onConfigure(){ > > > > super.onConfigure(); > > > > setVisibilityAllowed(createAccount); > > > > } > > > > } > > > > }; > > > > emailRepeat.setOutputMarkupPlaceholderTag(true); > > > > form.add(emailRepeat): > > > > > > > > Thanks a lot in advance! > > > > Best Regards > > > > Daniela > > > > > > > > > >
Re: Close Browser Behavior
On Wed, Mar 12, 2014 at 3:20 PM, Daniela L wrote: > Hi Martin, > thank you very much for your quick and brilliant answer :-) > Changing to AjaxCheckBox did the trick. > It seems to be very difficult to provide a secure way to invalidate user > data > cross browser compliant. I noticed that using a tablet with android or IOS > the > beforeunload is not triggered at all. Therefor I added a cleanup method to > the onInvalidate > of my custom session which should be triggered by the tomcats > session-timeout, but > it seems using mobile devices onInvalidate is not triggered? > onInvalidate() is called by the server when the client hasn't touched/used its http session for session-timeout minutes. It shouldn't matter whether it is a desktop or mobile client. > Best Regards > Daniela > > > 2014-03-12 13:21 GMT+01:00 Martin Grigorov : > > > Hi, > > > > On Wed, Mar 12, 2014 at 1:15 PM, Daniela L wrote: > > > > > Hi, > > > I am using a close browser behavior to clean up user data if the user > > > closes > > > the browser window. I also use a CheckBox to toggle the visibility of > > some > > > Textfields. Unfortunately the refresh through the click of the CheckBox > > > triggers the close browser > > > behavior. How can this be avoided? > > > Here is what I did (with wicket 6.12.0): > > > > > > > > > customerFirstName = new > RequiredTextField("customer.firstName"); > > > customerFirstName.setOutputMarkupPlaceholderTag(true); > > > closeBrowserBehavior = new AbstractDefaultAjaxBehavior() { > > >@Override > > > protected void respond(AjaxRequestTarget target) { > > > > > > AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent(); > > > } > > > > > > @Override > > > public void renderHead(Component component, IHeaderResponse > > > response) { > > > super.renderHead(component, response); > > > response.render(new > > > OnDomReadyHeaderItem("window.onbeforeunload = > > > function (e) {" > > > + "if (!window.dontAsk) {" > > > + "Wicket.Ajax.get({u: > > > '"+getCallbackUrl()+"', async: false});" > > > + "var message = 'my message.'," > > > + "e = e || window.event;" + "if (e) {" > > > + "e.returnValue = message;" + "}}" + > > > "return message;" > > > + > > > "};")); > > > } > > > }; > > > customerFirstName.add(closeBrowserBehavior); > > > form.add(customerFirstName); > > > > > > createAccountCB = new CheckBox("createAccountCB", new > > > Model(createAccount)){ > > > @Override > > > protected void onSelectionChanged(Boolean newSelection) { > > > super.onSelectionChanged(newSelection); > > > createAccount = !createAccount; > > > } > > > > > > @Override > > > protected boolean wantOnSelectionChangedNotifications() > > > { > > > return true; > > > > > > > This uses non-Ajax way to submit the new selection. > > As you noted this leads to 'beforeunload' event being fired. > > > > You will have to use AjaxCheckBox or AjaxFormComponentUpdatingBehavior to > > avoid the page reload. > > > > > > > } > > > }; > > > form.add(createAccountCB); > > > > > > emailRepeat = new TextField("emailRepeat", new > > > PropertyModel(appointCalendar, customer.eMailAdress")){ > > > @Override > > > protected void onConfigure(){ > > > super.onConfigure(); > > > setVisibilityAllowed(createAccount); > > > } > > > } > > > }; > > > emailRepeat.setOutputMarkupPlaceholderTag(true); > > > form.add(emailRepeat): > > > > > > Thanks a lot in advance! > > > Best Regards > > > Daniela > > > > > >
Re: Close Browser Behavior
Hi Martin, thank you very much for your quick and brilliant answer :-) Changing to AjaxCheckBox did the trick. It seems to be very difficult to provide a secure way to invalidate user data cross browser compliant. I noticed that using a tablet with android or IOS the beforeunload is not triggered at all. Therefor I added a cleanup method to the onInvalidate of my custom session which should be triggered by the tomcats session-timeout, but it seems using mobile devices onInvalidate is not triggered? Best Regards Daniela 2014-03-12 13:21 GMT+01:00 Martin Grigorov : > Hi, > > On Wed, Mar 12, 2014 at 1:15 PM, Daniela L wrote: > > > Hi, > > I am using a close browser behavior to clean up user data if the user > > closes > > the browser window. I also use a CheckBox to toggle the visibility of > some > > Textfields. Unfortunately the refresh through the click of the CheckBox > > triggers the close browser > > behavior. How can this be avoided? > > Here is what I did (with wicket 6.12.0): > > > > > > customerFirstName = new RequiredTextField("customer.firstName"); > > customerFirstName.setOutputMarkupPlaceholderTag(true); > > closeBrowserBehavior = new AbstractDefaultAjaxBehavior() { > >@Override > > protected void respond(AjaxRequestTarget target) { > > > > AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent(); > > } > > > > @Override > > public void renderHead(Component component, IHeaderResponse > > response) { > > super.renderHead(component, response); > > response.render(new > > OnDomReadyHeaderItem("window.onbeforeunload = > > function (e) {" > > + "if (!window.dontAsk) {" > > + "Wicket.Ajax.get({u: > > '"+getCallbackUrl()+"', async: false});" > > + "var message = 'my message.'," > > + "e = e || window.event;" + "if (e) {" > > + "e.returnValue = message;" + "}}" + > > "return message;" > > + > > "};")); > > } > > }; > > customerFirstName.add(closeBrowserBehavior); > > form.add(customerFirstName); > > > > createAccountCB = new CheckBox("createAccountCB", new > > Model(createAccount)){ > > @Override > > protected void onSelectionChanged(Boolean newSelection) { > > super.onSelectionChanged(newSelection); > > createAccount = !createAccount; > > } > > > > @Override > > protected boolean wantOnSelectionChangedNotifications() > > { > > return true; > > > > This uses non-Ajax way to submit the new selection. > As you noted this leads to 'beforeunload' event being fired. > > You will have to use AjaxCheckBox or AjaxFormComponentUpdatingBehavior to > avoid the page reload. > > > > } > > }; > > form.add(createAccountCB); > > > > emailRepeat = new TextField("emailRepeat", new > > PropertyModel(appointCalendar, customer.eMailAdress")){ > > @Override > > protected void onConfigure(){ > > super.onConfigure(); > > setVisibilityAllowed(createAccount); > > } > > } > > }; > > emailRepeat.setOutputMarkupPlaceholderTag(true); > > form.add(emailRepeat): > > > > Thanks a lot in advance! > > Best Regards > > Daniela > > >
Re: Close Browser Behavior
Hi, On Wed, Mar 12, 2014 at 1:15 PM, Daniela L wrote: > Hi, > I am using a close browser behavior to clean up user data if the user > closes > the browser window. I also use a CheckBox to toggle the visibility of some > Textfields. Unfortunately the refresh through the click of the CheckBox > triggers the close browser > behavior. How can this be avoided? > Here is what I did (with wicket 6.12.0): > > > customerFirstName = new RequiredTextField("customer.firstName"); > customerFirstName.setOutputMarkupPlaceholderTag(true); > closeBrowserBehavior = new AbstractDefaultAjaxBehavior() { >@Override > protected void respond(AjaxRequestTarget target) { > > AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent(); > } > > @Override > public void renderHead(Component component, IHeaderResponse > response) { > super.renderHead(component, response); > response.render(new > OnDomReadyHeaderItem("window.onbeforeunload = > function (e) {" > + "if (!window.dontAsk) {" > + "Wicket.Ajax.get({u: > '"+getCallbackUrl()+"', async: false});" > + "var message = 'my message.'," > + "e = e || window.event;" + "if (e) {" > + "e.returnValue = message;" + "}}" + > "return message;" > + > "};")); > } > }; > customerFirstName.add(closeBrowserBehavior); > form.add(customerFirstName); > > createAccountCB = new CheckBox("createAccountCB", new > Model(createAccount)){ > @Override > protected void onSelectionChanged(Boolean newSelection) { > super.onSelectionChanged(newSelection); > createAccount = !createAccount; > } > > @Override > protected boolean wantOnSelectionChangedNotifications() > { > return true; > This uses non-Ajax way to submit the new selection. As you noted this leads to 'beforeunload' event being fired. You will have to use AjaxCheckBox or AjaxFormComponentUpdatingBehavior to avoid the page reload. > } > }; > form.add(createAccountCB); > > emailRepeat = new TextField("emailRepeat", new > PropertyModel(appointCalendar, customer.eMailAdress")){ > @Override > protected void onConfigure(){ > super.onConfigure(); > setVisibilityAllowed(createAccount); > } > } > }; > emailRepeat.setOutputMarkupPlaceholderTag(true); > form.add(emailRepeat): > > Thanks a lot in advance! > Best Regards > Daniela >
Close Browser Behavior
Hi, I am using a close browser behavior to clean up user data if the user closes the browser window. I also use a CheckBox to toggle the visibility of some Textfields. Unfortunately the refresh through the click of the CheckBox triggers the close browser behavior. How can this be avoided? Here is what I did (with wicket 6.12.0): customerFirstName = new RequiredTextField("customer.firstName"); customerFirstName.setOutputMarkupPlaceholderTag(true); closeBrowserBehavior = new AbstractDefaultAjaxBehavior() { @Override protected void respond(AjaxRequestTarget target) { AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent(); } @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(new OnDomReadyHeaderItem("window.onbeforeunload = function (e) {" + "if (!window.dontAsk) {" + "Wicket.Ajax.get({u: '"+getCallbackUrl()+"', async: false});" + "var message = 'my message.'," + "e = e || window.event;" + "if (e) {" + "e.returnValue = message;" + "}}" + "return message;" + "};")); } }; customerFirstName.add(closeBrowserBehavior); form.add(customerFirstName); createAccountCB = new CheckBox("createAccountCB", new Model(createAccount)){ @Override protected void onSelectionChanged(Boolean newSelection) { super.onSelectionChanged(newSelection); createAccount = !createAccount; } @Override protected boolean wantOnSelectionChangedNotifications() { return true; } }; form.add(createAccountCB); emailRepeat = new TextField("emailRepeat", new PropertyModel(appointCalendar, customer.eMailAdress")){ @Override protected void onConfigure(){ super.onConfigure(); setVisibilityAllowed(createAccount); } } }; emailRepeat.setOutputMarkupPlaceholderTag(true); form.add(emailRepeat): Thanks a lot in advance! Best Regards Daniela