I develop website that must play music. But tomcat does not see mp3 file that I want to listen.
Here is part of my internalAccountTemplate.xhtml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view contentType="text/html">
<h:head>
<title><ui:insert name="title" /></title>
</h:head>
<h:body styleClass="defaultStyle" id="body">
<audio id="customAudio" preload='none'>
<source src='templates/KnifeParty.mp3' type='audio/mpeg' />
</audio>
</h:body>
</f:view>
</html>
When I press play button I get next error message
/WEB-INF/templates/KnifeParty.xhtml Not Found in ExternalContext as a Resource
My folder structure:
Also I have NewFile1.xhtml which work perfectly. But this file (NewFile1.xhtml) I opened in firefox not on Tomcat Server
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Xhtml work</title>
</head>
<body>
<audio id="yourAudio" preload='none'> <source
src='templates/KnifeParty.mp3' type='audio/mpeg' /> </audio>
<a href="#" id="audioControl">play!</a>
<script type="text/javascript">
var yourAudio = document.getElementById('yourAudio'), ctrl = document
.getElementById('audioControl');
ctrl.onclick = function() {
// Update the Button
var pause = ctrl.innerHTML === 'pause!';
ctrl.innerHTML = pause ? 'play!' : 'pause!';
// Update the Audio
var method = pause ? 'pause' : 'play';
yourAudio[method]();
// Prevent Default Action
return false;
};
</script>
</body>
</html>
In the web I saw similar problem (like this) and there people said registrer the extension on Tomcat Server
I wrote diffrent path to KnifeParty.mp3
file and changed his location, but this did not help.