Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A QuizGeneral Tech Technology & Software 2 years ago
Posted on 16 Aug 2022, this text provides information on Technology & Software related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
You can output any kind of content type from a servlet. Just set the headers right, and dump to the body of the request the content you want to send.
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + file);
// generate the content and send it to response.getOutputStream()
This will set the content-type to an excel file, and force the browser to download the file.
As a bonus, you can tell your servlet to listen to a specific path, and set the link with a real filename.
<servlet-mapping>
<servlet-name>Exportservlet-name>
<url-pattern>/export/*
request.getContextPath()%>/export/Myreport.xls">
Myreport.xls
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
Is Foldable Smartphone Technology the Future or Just a Trend?
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.
manpreet
Best Answer
2 years ago
Having a hard time figuring out how to send dynamic data to a web-app's user without having to create a file & using a dynamic link to static content using java technology. (The main reasons for avoiding the file creation on disk are security and speed)
This is something I have previously done in python, but this web-app is intended to be strictly java technology for maintenance purposes.
After doing a few searches in google I haven't gotten any further. Has anyone done this before or has a good idea for a starting point?