1

I'm using eclipse EE for Java. I created a new folder called videos under WebContent and in that folder is Cat Boarding.mp4

I'm just playing around to try to learn servlets and have the following code:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    PrintWriter out = response.getWriter();
    out.println("<html>");

    out.println("<head>");
       out.println("<title>HW3</title>");
    out.println("</head>");

    out.println("<body>");
       out.println("<b style='color:green;font-size:200%;'>Hello World </b>");

       out.println("<video width='400' controls>");
          out.println("<source src='/Hello World/WebContent/videos/Cat Boarding.mp4' type='video/mp4'>");         
          out.println("Your browser does not support HTML5 video.");
       out.println("</video>");

    out.println("</body>");

    out.println("</html>");
} 

when I try to run it says invalid source

When I run this locally I use: http://localhost:8080/HW/hw

as suggested I tried

out.println("<source src='/Hello%20World/WebContent/videos/Cat%20Boarding.mp4' type='video/mp4'>");

but that didn't work either

DCR
  • 14,737
  • 12
  • 52
  • 115

1 Answers1

0

the correct path is:

<source src='videos/Cat Boarding.mp4' type='video/mp4'>
DCR
  • 14,737
  • 12
  • 52
  • 115