当前位置: 代码迷 >> Java Web开发 >> jsp中嵌入播放器解决方法
  详细解决方案

jsp中嵌入播放器解决方法

热度:230   发布时间:2016-04-17 01:34:56.0
jsp中嵌入播放器
jsp中嵌入播放器,怎么无法播放中文的文件,已经修改了Tomcat下的server.xml(URIEncoding=utf-8还是不行,例如,
http://localhost:8080/source/中国.wmv,在地址栏直接打入可以播放,但是在嵌入式播放器中却不行,为什么呢

------解决方案--------------------
举个例子,如果你有一个mp3文件,webroot/music/啊.mp3,可以这么调用,前提是server.xml中一定要加入 URIEncoding="UTF-8"
HTML code
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>    <head>        <title>test</title>        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">        <meta http-equiv="pragma" content="no-cache">        <meta http-equiv="cache-control" content="no-cache">        <meta http-equiv="expires" content="0">        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">        <meta http-equiv="description" content="This is my page">    </head>    <body>        <object id="MediaPlayer1" width="350" height="64"            classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"            codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"            align="baseline" border="0"            standby="Loading Microsoft Windows Media Player components..."            type="application/x-oleobject">            <param name="URL" value="music/啊.mp3">            <param name="autoStart" value="true">            <param name="invokeURLs" value="false">            <param name="playCount" value="100">            <param name="defaultFrame" value="datawindow">            <embed src="music/啊.mp3" align="baseline" border="0" width="350"                height="68" type="application/x-mplayer2" pluginspage=""                name="MediaPlayer1" showcontrols="1" showpositioncontrols="0"                showaudiocontrols="1" showtracker="1" showdisplay="0"                showstatusbar="1" autosize="0" showgotobar="0" showcaptioning="0"                autostart="1" autorewind="0" animationatstart="0"                transparentatstart="0" allowscan="1" enablecontextmenu="1"                clicktoplay="0" defaultframe="datawindow" invokeurls="0">            </embed>        </object>    </body></html>
------解决方案--------------------
用ip地址和这个没有影响!

而你文件的放在Webapps的source下,那就改成../source/啊.mp3,两个地方都得改

建议你测试一下,在来回复
  相关解决方案