对于这个可能很愚蠢的问题,我很抱歉,我是Java的新手。 我有一个简单的IntelliJ Java项目,支持Flex。该项目包含index.jsp页面。在构建项目之后,.swf被放置在 WEB-INF / classes 文件夹中。
生成的工件的目录结构是:
index.jsp
Web-inf
web.xml
classes
main.swf
请问请问如何将main.swf嵌入index.jsp?如果简单 - 如何访问位于 WEB-INF / classes 文件夹中的文件?
答案 0 :(得分:1)
要在任何网页中嵌入SWF文件 - 包括从JSP文件生成的网页 - 有几个选项:
1)使用嵌入式HTML标记,如下所示:
<embed src="classes/main.swf" quality="high"
width="500" height="250" name="Sample" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
YouTube等网站使用此方法轻松嵌入。
2)使用像SWFObject这样的JavaScript库。 Flex Framework中的默认HTML模板使用此模板。基本上,它是一种花哨的方式来确定显示哪个浏览器并选择嵌入SWF的最佳方式。
答案 1 :(得分:1)
为了补充Constantiner的评论,无论IDE如何,您都可以设置项目以使用此约定:
/web
/flex - Where your Main.swf goes and anything it it needs (i.e. css, jpgs, mp3s, misc assets
/META-INF - Where your context.xml goes, not accessible to clients
/WEB-INF
/classes - The directory where all your pre-compiled java .class files goes
/flex - Where blazeDS xml config files go
/lib - Where your java shared libraries go (i.e. jar's
web.xml - Where you set up your container's listeners and servlet mappings
index.jsp - Your .jsp will have access to /flex stuff... You could of course promote the contents of /flex to be directly under /web
index.html - Hello World