Easy tech stuff!

request.getParameterValues()

Posted: January 14th, 2008 | Author: Nischal Shetty | Filed under: General | No Comments »

request.getParameterValues(String) in java helps retrieve a String array as parameter from the JSP.

i.e. If you have more than one value set for a variable in the JSP with the same name, you can get it as a String array using request.getParameterValues(“parameterName”)

Ex. in my jsp I set the variable as follows:

<input type=”hidden” name=”colour” value =”red”>

<input type=”hidden” name=”colour” value =”blue”>

<input type=”hidden” name=”colour” value =”green”>

Next, I try to obtain these values at the back-end java file as follows:

String colour[] = request.getParameterValues(“colour”);

All the three colours set in the JSP will be obtained in an array!!!

http://www.techtamasha.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/furl_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/google_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/myspace_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.techtamasha.com/wp-content/plugins/sociofluid/images/twitter_48.png


Leave a Reply