How to deal with multi-valued parameters in a servlet?

Answers were Sorted based on User's Feedback



How to deal with multi-valued parameters in a servlet?..

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

How to deal with multi-valued parameters in a servlet?..

Answer / tulasi vani

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

Post New Answer

More Servlets Interview Questions

Why is Servlet so popular?

0 Answers  


Explain url encoding in servlet?

0 Answers  


Is there any differance b/w getting servlet context from servlet config and session? if yes then what is that?

7 Answers  


Can we override servlet service method?

0 Answers  


How do you load an image in a Servlet?

0 Answers  






What are the ways to handle multi-threading in servlets?

0 Answers  


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?

0 Answers  


Can we call destroy() method inside the init() method? What happens when we do so?

9 Answers   Ericsson,


What are different types of Servlets?

12 Answers  


Why the container loads server at the application startup and how?

0 Answers  


What are setComment and getComment methods in Cookies?

2 Answers  


How we can create war file in servlet?

0 Answers  


Categories