HTML + JAVASCRIPT

Hello,

In my Vaadin application I would like to display dynamic HTML content. I saw how to do that with CustomLayouts but my problem is that I should be able to receive HTML OR Javascript.

The string I receive could be for example :

  • Template
  • or any HTML or Javascript content

Using customlayout, the script is not executed…

Do you have an idea?

edit:and of course I know the function executeJavascript, but I don’t think i can use it, because i don’t know if the content will be javascript or html…

I found the problem but I still have a question. Here is my solution:


window.addComponent(new CustomLayout(new ByteArrayInputStream("<div /><script type='text/javascript'>window.location = 'http://www.vaadin.com'</script>".getBytes())));

But why do I have to write that

???

Best regards!