I want to change dynamically the UI of my servlet when an event occurs, with JavaScript code. I charge my UI in a ‘div’ element of a JSP page, a div with id=“forjs”. I can remove this element from page in my UI with this code:
JavaScript.getCurrent().execute("element = document.getElementById('forjs');parent = element.parentNode;parent.removeChild(element);");
However, after that, I try to charge a new UI with this code but nothing occurs, no element is charged:
String script = "vaadin.initApplication('forjs', {"+
"'browserDetailsUrl': 'two',"+
"'serviceUrl': 'two',"+
"'widgetset': 'com.vaadin.DefaultWidgetSet',"+
"'theme': 'mytheme',"+
"'versionInfo': {'vaadinVersion': '7.1.7'},"+
"'vaadinDir': 'VAADIN/',"+
"'heartbeatInterval': 300,"+
"'debug': true,"+
"'standalone': false,"+
"'authErrMsg': {"+
"'message': 'Take note of any unsaved data, and <u>click here</u> to continue.caption': 'Authentication problem'"+
"},"+
"'comErrMsg': {"+
"'message': 'Take note of any unsaved data, and <u>click here</u> to continue.caption': 'Communication problem'"+
"},"+
"'sessExpMsg': {"+
"'message': 'Take note of any unsaved data, and <u>click here</u> to continue.caption': 'Session Expired'"+
"}"+
"});";
JavaScript.getCurrent().execute(script);
Why does it not work? I don’t get any error but second UI is not charged and shown. Any ideas?
Next week I will go on holidays but I wait for answers.
Help, please.