How to deal with multi-valued parameters in a servlet?
Answers were Sorted based on User's Feedback
Answer / janet
Use the getParameterValues() method. This returns a String
array(or null) containing all the values of the parameter
requested.
Is This Answer Correct ? | 2 Yes | 0 No |
To get the multi-valued parameters in servlet we can use
getParameterValues().
request.getParameterValues() which returns an array of
values which are associated with it.
Use an Enumeration to store the values.It has two methods
namely hasMoreElements()which is used in a while loop
which executes unitl it finds another element in the
enumeration and hasNext()which is again used in a while
loop and executes until it has a nextElement and retrives
the required data.
Is This Answer Correct ? | 1 Yes | 0 No |
Why is Servlet so popular?
Explain url encoding in servlet?
Is there any differance b/w getting servlet context from servlet config and session? if yes then what is that?
Can we override servlet service method?
How do you load an image in a Servlet?
What are the ways to handle multi-threading in servlets?
Once the destroy() method is called by the container, will the servlet be immediately destroyed? What happens to the tasks(threads) that the servlet might be executing at that time?
Can we call destroy() method inside the init() method? What happens when we do so?
What are different types of Servlets?
Why the container loads server at the application startup and how?
What are setComment and getComment methods in Cookies?
How we can create war file in servlet?