Hi everyone, I want to test small web application with jee.In this application I want to add some songs files which can run on line and can be downloaded.But I start just studying now and I don't know how to make to play songs in jsp or jsf and I also don't know to make links which can download songs files . Please help and teach me.Thanks.
+1
A:
The downloading of songs is pretty easy. Just make a link to the file on your server and, because of that files MIME type, your browser will automatically know what do with it. For example, if you want provide a download for mp3:
<a href='mySong.mp3'>Download Now</a>
That would generate a download for the music file.
As for streaming music, well that's a bit tougher. There are different approaches for this, some involving Javascript or Flash. If you want to try some bleeding edge HTML 5 stuff, there is a very cool approach. This works in Google Chrome, and possibly Firefox too (i havent tested that).
<audio src="horse.ogg" controls="controls">
Your browser does not support the audio element.
</audio>
This allows you to embed your audio right in the web page without any Javascript.
darren
2010-01-11 04:02:44