Forums Register Login

basic servlet question

+Pie Number of slices to send: Send
Hi,

I have written a servlet where it downloads a file to client machine.
This servlet does not have any JSP.
If I type something like below on the URl the servlet will download the file based on the input paramter in the URL link.

http://localhost:8080/donload marketid=12

I want to know how do I enable to get the marketid = 12 in the servlet?

Is there any thing I need to add in the web.xml?

thanks
Trupti
+Pie Number of slices to send: Send
You can get parameters entered in url in servlets

URl => http://localhost:8080/download?marketid=12
HttpServletRequest request;
String mrktId = request.getParameter("marketid");
+Pie Number of slices to send: Send

Does this require? Service method of HttpServlet provides prepared object for HttpServletRequest and HttpServletResponse.

This should be enough.
+Pie Number of slices to send: Send
 

Does this require? Service method of HttpServlet provides prepared object for HttpServletRequest and HttpServletResponse.


Don't use the "service" method - use the "doGet" method.
+Pie Number of slices to send: Send
 

Ulf Dittmer wrote:Don't use the "service" method - use the "doGet" method.


Oops! sorry I really missed it and I meant to suggest doGet only.
This is my favorite tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 649 times.
Similar Threads
java.lang.ClassNotFoundException: web.CalcServlet
url-pattern for a jsp file
struts1.2 html:select tag not working
Struts ActionForm help
servlet Properties files not found error
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:54:48.