首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在jsp网站上取消付费视频

在jsp网站上取消付费视频
EN

Stack Overflow用户
提问于 2012-08-26 14:07:50
回答 1查看 3.2K关注 0票数 0

嗨,我正在创建一个网站,因为在线试镜的university.here客户可以上传他们的表演视频在youtube上。

代码语言:javascript
复制
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?
EN

回答 1

Stack Overflow用户

发布于 2012-08-27 06:40:17

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

代码语言:javascript
复制
<%@ 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>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12130773

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档