Results 1 to 8 of 8
  1. #1
    anilnivargi is offline Member
    Join Date
    Jul 2013
    Posts
    3
    Rep Power
    0

    Default How to get the Particular Video file from one jsp page to another

    Hi..i created one jsp page i took videos from the folder.Whenever i am clicking particular video it is not playing that video..It is taking last video only...Please help me..just i posted both jsp pages..
    First.jsp is as follows..
    <%
    File f=new File("E:/Videos");
    File[] list=f.listFiles();
    String s[]=new String[list.length];
    for(int i=0;i<list.length;i++){
    s[i]=list[i].toString();
    %>
    <tr>
    <td><input type="hidden" name="file" value="<%=s[i] %>">
    </td>
    <td><input type="submit" name="play" value="Play"></td>

    </tr>
    <%}%>
    the second jsp page is as follows..

    <%
    String s=request.getParameter("file");
    %>
    <object id="MediaPlayer" width="300" height="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
    standby="Loading Windows Media Player..." TYPE="application/x-oleobject">
    <param name="FileName" VALUE="<%=s%>">
    <param name="ShowControls" VALUE="true">
    <param name="ShowStatusBar" value="false">
    <param name="ShowDisplay" VALUE="false">
    <param name="autostart" VALUE="false">
    <embed type="application/x-mplayer2" src="<%=request.getContextPath()%>" name="MediaPlayer"
    width="300" height="180" ShowControls="1" ShowStatusBar="1" ShowDisplay="0" autostart="false"> </embed>
    </object>
    </body>
    Whenever clicking specific video it is not taking that one..it is taking last video only..please help me im not getting properly..

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: How to get the Particular Video file from one jsp page to another

    might be a browser caching problem. Try adding:

    Java Code:
    response.setHeader("Cache-Control","no-cache"); 
    response.setHeader("Pragma","no-cache"); 
    response.setDateHeader ("Expires", 0);
    to the top of your JSPs, to see if that changes anything.


    And btw, you know that this:

    Java Code:
    File f=new File("E:/Videos");
    will only work on your computer, right? As soon as the web application is put somewhere else, it can't reach your e:\videos anymore.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: How to get the Particular Video file from one jsp page to another

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    anilnivargi is offline Member
    Join Date
    Jul 2013
    Posts
    3
    Rep Power
    0

    Default Re: How to get the Particular Video file from one jsp page to another

    hi..sir it is not working ....that folder is in my system only..it is taking the last video only..but i want whenever clicking particular video we want play that video only. But here u can take any video its playing last video only..stilll im not getting correct o/p. I think requset.getparameter("file") is there know.it is taking the last video only..please help me is there any solution...

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: How to get the Particular Video file from one jsp page to another

    Sure there is a solution. But it is not going to present itself if you do not make an effort to find out what the actual problem is. The only thing you have now is that "it doesn't work as I expect it". Great, now step 1: figure out why. Then comes step 2: fixing it.

    Here is an exercise for you: you are generating a form in the first JSP. Use your browser to do a "view page source" to get the actual HTML you're generating. I think you'll find that you have multiple hidden input fields all with the exact same name: 'file'. Now you submit all those hidden input values, all under the same name. In JSP 2 you fetch "the file":

    Java Code:
    String s=request.getParameter("file");
    But you fetch only one. Now say that you have a hundred videos, which of those hundred are you expecting to get here?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    anilnivargi is offline Member
    Join Date
    Jul 2013
    Posts
    3
    Rep Power
    0

    Default Re: How to get the Particular Video file from one jsp page to another

    Hi..i will send all my code..still im not getting..
    My first page is ..
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@page import="java.io.*,java.util.*" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Class Video</title>
    </head>
    <body>
    <form action="VideoPlay.jsp" method="post">
    <table>
    <%
    File f=new File("E:/Videos");
    File[] list=f.listFiles();
    if(list.length!=0){
    String s[]=new String[list.length];
    for(int i=0;i<list.length;i++){
    s[i]=list[i].toString();
    String fi=list[i].getName();
    %>
    <tr><td><%=fi %></td>
    <td><input type="hidden" name="file" value="<%=s[i] %>">
    </td>
    <td><input type="submit" name="play" value="Play"></td>

    </tr>
    <%}}
    else{
    %>
    <tr>
    <td>There is no any files in the database...</td>
    </tr>
    <%
    }
    %>
    </table>
    </form>
    </body>
    </html>


    My VideoPlay.jsp is as follows..

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ page import="java.io.File" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <% String s=request.getParameter("file");%>
    <script type="text/javascript">mh_sh_highlight_all('java');</script>
    <object id="MediaPlayer" width="300" height="180" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
    standby="Loading Windows Media Player..." TYPE="application/x-oleobject">
    <param name="FileName" VALUE="<%=s%>">
    <param name="ShowControls" VALUE="true">
    <param name="ShowStatusBar" value="false">
    <param name="ShowDisplay" VALUE="false">
    <param name="autostart" VALUE="false">
    <embed type="application/x-mplayer2" src="<%=request.getContextPath()%>" name="MediaPlayer"
    width="300" height="180" ShowControls="1" ShowStatusBar="1" ShowDisplay="0" autostart="false"> </embed>
    </object>
    </div>
    </body>
    </html>


    Please tell me the modifications im not getting to play the particular video..
    Last edited by anilnivargi; 08-03-2013 at 09:27 AM.

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: How to get the Particular Video file from one jsp page to another

    Is it really too much trouble to go through two pages on this site, which I linked at #3?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: How to get the Particular Video file from one jsp page to another

    Quote Originally Posted by anilnivargi View Post
    Please tell me the modifications im not getting to play the particular video..
    No. Figure it out yourself, that's your job. I'm not going to do anything else here until you at least listen to Darryl AND you change your attitude towards this problem. YOU need to do this, which means you have to understand it first. I'll only help you to understand it, but so far you didn't listen to anything said here and you just dumped your code again which helps nobody, least of all you.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Please do not put video advertisements that run loud on page load
    By boumbh in forum Suggestions & Feedback
    Replies: 2
    Last Post: 01-24-2013, 04:55 PM
  2. Problem embedding flash (swf) files in jsp page for video streaming
    By marktheman in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-05-2011, 11:09 PM
  3. how to extract video from web page
    By abhishektyagi789 in forum Networking
    Replies: 5
    Last Post: 03-10-2011, 10:29 AM
  4. embed the video in the html page by youtube api
    By javastuden in forum Advanced Java
    Replies: 6
    Last Post: 06-17-2010, 02:23 PM
  5. Embed video on web page - Application to Applet
    By ConvoyTh in forum Java Applets
    Replies: 1
    Last Post: 11-27-2008, 08:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •