gpt4 book ai didi

jsp - 在jsp网站上显示视频

转载 作者:行者123 更新时间:2023-12-03 06:02:35 26 4
gpt4 key购买 nike

嗨,我正在为大学创建一个网站在线试听。客户可以在这里将自己的表演视频上传到youtube。

So my question is how can i display those specific videos on my web page as admin should see it and be able to comment also? 
Is there anything like description or trend with help of which i can get those videos only which are uploded by my clients?
and i want to get the path of the videos so as i can just call them in iframe?

最佳答案

我写了一个JSP。请记住,这只是一个示范。您需要重写它。正如我所发布的,重新启动Web服务器时数据将丢失。您应该将数据放入数据库或文件中。

<%@ page import="java.util.*" %>
<!DOCTYPE html>
<body>
<iframe id="videoFrame" width="420" height="345">
</iframe><br/><br/>
Watch a video:
<%
HashMap<String,String> map = (HashMap)application.getAttribute("map");
if(map == null){
map = new HashMap<String,String>();
application.setAttribute("map", map);
}
String id = request.getParameter("vid");
String title = request.getParameter("title");
if(id != null && !"".equals(id.trim())
&& title != null && !"".equals(title.trim()))map.put(id.trim(),title.trim());
Iterator<String> iter = map.keySet().iterator();
while(iter.hasNext()){
String i = iter.next();
String t = map.get(i);
out.print("<a href='?vid=" + i + "&title=" + t + "' >" + t + "</a> ");
}
%>
<form>
Add your video:
id<input name="vid" type="text" />
title<input name="title" type="text" />
<input type="submit" />
</form>
<script>
var url = "http://www.youtube.com/embed/${param.vid}";
document.getElementById("videoFrame").src = url;
</script>
</body>
</html>

关于jsp - 在jsp网站上显示视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12130773/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com