I am currently trying to use JSP to build some small litle apps and have not got stuck on something, downloading files from a webserver. I just cant seem to work out how I should go about this task.
Sep 29, 2008 leonZz wrote: i have some code for download file from server to client. User can select path file to save by dialog open/save/cancel. After download finish i want to reload jsp page to display data that change. But it s not work, jsp page dont reload. Here is my code.If you checked the logs, you should see an IllegalStateException. Although it is possible to run a jsp file using wamp with additional configuration, a better alternative would be to use Xampp which runs apache tomcat server (used for jsp file execution) in default installation.
Are there any JSP developers here who know to go about this and could point me in the right direction? Itunes download error tap to retry.
BalusC
873k309309 gold badges32253225 silver badges32673267 bronze badges
tom mantom man
1 Answer![]()
If the resource is static, just put it in the public webcontent (there where your JSP/HTML/CSS/JS/etc files also are) and include a link to it in your JSP.
The servletcontainer will worry about setting the right HTTP response headers.
If the resource is dynamic, create a servlet which obtains an
InputStream of the content somehow (new FileInputStream , resultSet.getBinaryStream() , etc.etc.) and writes it to the OutputStream of the response along at least the Content-Type and Content-Disposition response headers. Finally just link to that servlet in your JSP.
You can find a basic example in this article.
Golden Vegas – Inside (radio edit) [3:24] 05. Welcome to my house mp3 download 320kbps. Tito Torres – Shine On Me (feat Max Urban – radio house edit) [3:19] 04.
Jsp Download File From Server
The BalusCBalusC
Content-Type header informs the client about the content type of the file so that it knows what application it should use to open it. The Content-Disposition header informs the client what to do with it, displaying it inline or saving as attachment.
873k309309 gold badges32253225 silver badges32673267 bronze badges
Jsp Download File From Server DownloadNot the answer you're looking for? Browse other questions tagged javajspservlets or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |