⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mp3.jsp

📁 jsp+ajax实例
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page language="java" import="java.sql.*"%>
<%@page import="java.io.*"%>
<%String id=request.getParameter("id");
try
{


Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String db=getServletContext().getRealPath("\\")+"music.mdb";
File dbpath=new File(db);
String path = new java.io.File(db).getAbsolutePath();
Connection dbcon= DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};" +
"DBQ="+path);
PreparedStatement stat=dbcon.prepareStatement("select file,music,name from mp3 where id="+id);
ResultSet result=stat.executeQuery();
result.next();
String musicURL="audio/"+result.getString("file");
byte bb[]=musicURL.getBytes("ISO-8859-1");
musicURL=new String(bb);
String musicName=result.getString("music");
String musicgeshou=result.getString("name");
%>
<html>
<head>
<title>[音频]歌曲:<%=musicName%> 艺术家:<%=musicgeshou%>@_@</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">
<!--
body {
	background-color: #0099FF;
}
-->
</style></head>
<link href="css/css.css" rel="stylesheet" type="text/css">
<body topmargin="0px" bottommargin="0px">
<table  border="1" align="center" bordercolor="#000000">
  <tr>
    <td class="padding">
      <center>
        
        歌名:<font color=yellow><%=musicName%></font>艺术家:<font color=yellow><%=musicgeshou%></font>
      </center>
      <table  border="0" align="center">
        <tr>
          <td height="70" width="400" align="center"><p align="center">
              <object id="mp" width="400" height="70" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" border="0" standby="加载中……" type="application/x-oleobject">
                <param name="FileName" value="<%=musicURL%>">
                <param name="ShowControls" value="1">
                <param name="ShowPositionControls" value="1">
                <param name="ShowAudioControls" value="1">
                <param name="ShowTracker" value="1">
                <param name="ShowDisplay" value="0">
                <param name="ShowStatusBar" value="1">
                <param name="AutoSize" value="1">
                <param name="ShowGotoBar" value="0">
                <param name="ShowCaptioning" value="0">
                <param name="AutoStart" value="1">
                <param name="PlayCount" value="1">
                <param name="AnimationAtStart" value="0">
                <param name="TransparentAtStart" value="0">
                <param name="AllowScan" value="0">
                <param name="EnableContextMenu" value="1">
                <embed src="<%=musicURL%>" width=400 height=70 autostart="1" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=media&sba=plugin&"  showcontrols="1" showpositioncontrols="0"
 showaudiocontrols="1" showtracker="1" showdisplay="0"
 showstatusbar="1"
 autosize="0"
 showgotobar="0" showcaptioning="0" autorewind="0"
 animationatstart="0" transparentatstart="0" allowscan="1"
 enablecontextmenu="1" clicktoplay="0" invokeurls="1"> </embed>
            </object>
          </p></td>
        </tr>
      
      
        <%
result.close();

}
catch(Exception e)
{
out.println(e);
}
%>
        <tr>
          <td valign="top"> <iframe src="list.jsp" name="a" height="240" width="420" marginwidth="0"  marginheight="0" scrolling="No" frameborder="0" id="a"></iframe> -</td></tr>      
        <tr><td valign="top">
        <center><a href="index.jsp">返回主页</a>        <a href="javascript:window.close()"> 关闭窗口</a>   </center> 
    </td></tr>
  
</table>
<script language="javascript">
function click() {
if (event.button==2) {
alert('对不起,本页禁用右键!')
}
}
document.onmousedown=click
</script>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -