0

我想在 vaadin 窗口中添加由 pdf2swf 创建的 swf 文件,

所以我尝试使用 Vaadin 书中给出的代码https://vaadin.com/book/-/page/components.embedded.html

final ClassResource flashResource = new ClassResource("Requirements.swf", getMainWindow().getApplication());
final Embedded embedded = new Embedded("Embedded Caption", flashResource);
embedded.setType(Embedded.TYPE_OBJECT);
embedded.setMimeType("application/x-shockwave-flash");
embedded.setWidth("100px");
embedded.setHeight("100px");
mainWindow.addComponent(embedded);
mainWindow.requestRepaintAll();

但我仍然无法在 vaadin 窗口中看到 swf。

谢谢,约格什

4

1 回答 1

0

I imagine the problem here is the location of the SWF in your web application; in this code, you are using a ClassResource - this means "Requirements.swf" needs to be in the root of the classpath of the web application.

Typically, the easiest place to put this for a quick test is WEB-INF/classes.

See https://vaadin.com/book/-/page/application.resources.html for the different resource classes, and where to place those resources.

Note that putting the file in the root of the webapplication is not quite as easy as you imagine, as you'll have to change the default servlet mapping configuration.

于 2012-06-27T06:54:40.867 回答