I am a complete beginner at working with the Vaadin framework. One of the things that I wanted to do was to take an HTML page (not an external resource, but something that I wrote) and display it within a Vaadin panel in my SkeletonFrame Application.I dont know if this is the right way to do it, but here goes:
I have a page called “myhtml.html”, an image called “image.jpg” and my application file SkeletonframeApplication.java, (all in the same directory). To display the page, I added the following code to my SkeletonframeApplication.java:
Resource file = new ClassResource("myhtml.html",rightPanel.getApplication());
Embedded emb = new Embedded("TEST",file);
emb.setType(Embedded.TYPE_BROWSER);
emb.setWidth("100%");
emb.setHeight("100%");
rightPanel.addComponent(emb);
------x------
The code in myhtml.html is:
Insert title here
sad
-----x-----
So far, I have tried to see the output in 3 browsers, Chrome 5.0.375.127, Firefox 3.6.8, and IE 8.0.7600, and in all three of them, I did not see the image “image.php”, but in all 3, I did see the text in the body “sad”.
Please let me know if a) I am trying to accomplish my task in a really wierd way or b) if I am doing it generally correctly (ie: ClassResource is the way to go), then how would I fix my mistakes.
I’d probably use CustomLayout and set that to your Panel’s layout.
Remove the html head info from your layout, since this is not a complete page, but just a snippet of HTML inside your DOM tree.
Try to get it working with a static image first (place it e.g. in the themes folder. When you know you have a statically functioning custom page inside a Vaadin app, then try to serve it from the PHP file. I guess you now have some issues with the path to the image.php file which can not be found.