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

解决方案 »

  1.   

    举个例子,如果你有一个mp3文件,webroot/music/啊.mp3,可以这么调用,前提是server.xml中一定要加入 URIEncoding="UTF-8"
    <%@ 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>
      

  2.   

      可是,我想用ip地址的方式,因为我的视频资源不放在项目里面而是在Tomcat下的Webapps下的sourse文件夹下的,并且也不一定在我的本机上,所以用相对路径的方式不太合适,不知道你的可以这样吗
      

  3.   

    用ip地址和这个没有影响!而你文件的放在Webapps的source下,那就改成../source/啊.mp3,两个地方都得改建议你测试一下,在来回复
      

  4.   

    非常感谢,怎样播放swf格式的文件啊,代码和这个一样吗