GetParameterValues ​​usage

zhaozj2021-02-16  73

What program language do you want to learn:
JSP < Input type = "checkbox" name = "langtype" value = "php"> php perl

These INPUT TYPE names are called LangType, if you take these values ​​with Request.GetParameter ("LangType"), which one is to take? So at this time, you can't use GetParameter to take information, and you should use getParameterValues ​​to take information. Use this method to retrieve the input type of the front end in an array, so you can declare a string array to undertake, usage as follows :

String langtype [] = Request.getParameterValues ​​("langtype");

// Use getParameterValues ​​method to take the verified value within the langType [] array

if (LangType! = NULL)

// front end user, if you have not hook

//Request.getParameterValues ​​("LangType ") will receive NULL values

{

Int size = java.lang.reflect.Array.getLength (LangType);

/ / Get this array size

For (int i = 0; i

{

Out.println (langtype [i] "
");

}

// Take the array data using a FOR back ring

}

转载请注明原文地址:https://www.9cbs.com/read-15109.html

New Post(0)