Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

play videos using jsp problem?

 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hiii can anyone tell me how can i play videos in my website,using jsp or just like youtube...??
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not anything to do with JSP. You'd just use the appropriate HTML markup.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes actually i did it using html and jsp,
i was putting the embed tag into anchor tag.
and i was taking element Id using Jsp Request and playing that video in my other div, but i don't know why but my embed tags are not working,
i just jst need to knw is there any other way to do this, or m i going wrong??
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, all this happens on the client side, so I don't see what the JSP dimension is yet. Perhaps if you were to post the non-working code, someone could comment on it.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my code, but it's not working..


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you examined what's sent to the browser to make sure that the JSP evaluation produces why you expect?
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
browser is getting value of 'vname' variable.
and vname is passed as the video name..
please correct me if i m wrong..
 
Albareto McKenzie
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but are you getting the expected value there or are you getting just a null or other strange thing?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea. I don't use video. The JSP source isn't likely to be helpful. Post (properly indented and formatted and using code tags) what's being sent to the client and perhaps somebody that's familiar with vide can spot a problem.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m facing a problem while i am playing video using jsp on click of anchor tag..
here is my code....



can anyone tell me what i am doing wrong here..?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said, posting the JSP source is not helpful! That is not what the browser will see. If you want help, you're going to have put some effort into this.

Post the code as sent to the browser. That's what the browser is seeing and what is not working.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the code my browser is producing;



Is this what you are asking for.
i apologies if i m not getting you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that does help because it shows that the value of the src attribute is suspect. It's specific as page-relative, and that frequently causes problems in web applications.

I would change it to a server-relative URL that begins with the context path and see if that helps.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i change it can you tell me..?
 
Gopakumar Naryanan
Ranch Hand
Posts: 72
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try replacing the href of <a> with bold highlighted code below:



with ${pageContext.request.contextPath}/video_name=video.wmv

(I guess Bear also wanted to tell the same. am i right bear?)
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i m not getting, i don't know abut expression language, i tried like this:

Click to play ${pageContext.request.contextPath}/video_name=video.wmv
<% String vname=null;
vname=request.getParameter("video_name");
%>

isn't it??
 
Gopakumar Naryanan
Ranch Hand
Posts: 72
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's ok.



instead of "index.jsp" substitute value of "path" over there.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is the code is like this??



Here i m getting an error after clicking to the link...
 
Gopakumar Naryanan
Ranch Hand
Posts: 72
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please post the Error Details?
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the error:

HTTP Status 404 - /video/video_name=video.wmv

type Status report

message /video/video_name=video.wmv

description The requested resource (/video/video_name=video.wmv) is not available.
Apache Tomcat/7.0.11

But my video is in my project...
but it'd not in the separate folder, should i separate it..?
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i seperated it into a new folder, now the error is removed but nothing i m getting after clicking....
 
Gopakumar Naryanan
Ranch Hand
Posts: 72
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
prior to making the above change , what was the error you were getting?

I didn't understand why you are using vname variable?
You can't get the request parameter in the form itself.(vname would be always null in this case)

By the way when you click the hyperlink where does the request go?

Can you explain a bit clear?
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay, here is my new code:



whenever i m clicking it will go to my video folder in my project and check for video.wmv.
Although i used request.getParameter, because i want to play videos like youtube, therefore i would add more videos and take the parameter and play those videos..\
Hope you get what i want to say..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Until you fix the URL, you will continue to have problems.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which URL problem bear, could you please explain, still i m not getting you..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I repeat:
Bear Bibeault wrote:Yes, that does help because it shows that the value of the src attribute is suspect. It's specific as page-relative, and that frequently causes problems in web applications.

I would change it to a server-relative URL that begins with the context path and see if that helps.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay, i changed my src like this:




Is this bear what you are saying...
But still it's not working..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the generated URL work when your type it into the browser?
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no it's not working bear...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then you need to find out what the appropriate URL needs to be. Anything else is a wast of time. Until you can figure out how to properly address the video, writing code to do so will fail.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay..
Thank You..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic