Ai
1 Star 6 Fork 1

Allen Iverrui/jsp 音乐红茶馆网站

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
音乐搜索.jsp 1.94 KB
一键复制 编辑 原始数据 按行查看 历史
Allen Iverrui 提交于 2023-02-15 22:42 +08:00 . first
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page import="java.io.File"%>
<%@page import="java.io.PrintStream"%>
<%@page import="java.io.FileOutputStream"%>
<%@page import="java.io.FileInputStream"%>
<%@page import="java.util.*"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>音乐搜索</title>
<style type="text/css">
@import url("css样式/top.css");
</style>
</head>
<%
//防止中文乱码
request.setCharacterEncoding("utf-8");
String name=request.getParameter("musicname");
if(name!=null)
{
String filename=this.getServletContext().getRealPath("/")+"musicsearch"+File.separator+"search.txt";
Scanner in=new Scanner(new FileInputStream(filename),"utf-8");
int successfind=0;
String judge;
while(in.hasNext())
{
judge = in.nextLine();
// 用于搜索出错调试 out.println(judge+" "+name);
if(judge.indexOf(name)!=-1)
{
successfind=1;
if(judge.substring(judge.length()-3,judge.length()).equals("mp3"))
{
%>
<p class="topfont">"<%=judge.substring(0,judge.length()-4)%>"音乐成功找到</p>
<audio src="music/<%=judge%>" controls="controls" preload id="music">
</audio>
<%
}else
{
%>
<br>
<br>
<br>
<a class="topfont">"<%=judge.substring(0,judge.length()-4)%>"mv成功找到</a>
<br>
<video width="210" height="210" controls="controls" x5-video-player-type="h5-page">
<source src="mv/<%=judge%>" type="video/mp4">
</video>
<%
}
}
}
if(successfind==1) {
}
else {
%>
<script>
alert("没有找到该音乐信息");
</script>
<%
}
}
%>
<body class="downbody">
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/alleniverrui/jsp-music-website.git
git@gitee.com:alleniverrui/jsp-music-website.git
alleniverrui
jsp-music-website
jsp 音乐红茶馆网站
master

搜索帮助